// SPDX-License-Identifier: MIT

//https://ZombieBits.ROCKS visit for latest
//?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
//?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
//??????????????????????????????????jwwwww?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
//??????????????????????????????????z$$$$B?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
//??????????????????????????????????z$$f?????????????????????????????????????????????????{mmmmmmmmmmmmm[???????????????????????????????????????????????????????
//??????????????????????????????????z$$f?????????????????????????????????????????{ZZx??QZZmmmmmmmmmmmmmZZZZZZZZ[???????????????????????????????????????????????
//??????????????????????????????????z$$f????????????????????????????????????][[[[1mmu[[0mmmmmmmmmmmmmmmmmmmmZZZ[???????????????????????????????????????????????
//??????????????????????????????????z$$f????????????????????????????????????nmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmr??????????????????????????????????????????????????
//???????????????????????????????]$$$$$f????X$$$$$$$$$$/?????????????????}mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm[???????????????????????????????????????????????
//???????????????????????????????]$$$$$f????X$$bwwwwo$$/?????????????????[XXLmmkhhhhQuuuuuuuuuuuuvUUUUU00Zhhpmm[???????????????????????????????????????????????
//???????????????????????????????]$$$$$f????X$$t????Y$$/????????????????????nmm%$$$$c;;;;;;;;;;;;!|||||XYQ$$amm[???????????????????????????????????????????????
//??????????????????????????????????????????X$$t????Y$$/????????????????????nmm%$#;;z$$CYv;;;;;;;!|||||||u$$amm[???????????????????????????????????????????????
//??????????????????????????????????????????X$$t????Y$$/????????????????????1ff&$#;;-ttkoq;;;;;;;!|||||||u$$amm[???????????????????????????????????????????????
//??????????????????????????????????????????X$$t????Y$$/???????????????????????M$#;;;;;M$*;;;;;;;!|||||||u$$amm[???????????????????????????????????????????????
//???????????????????????????????????????[$$$$$t?[$$$$$/???????????????????????M$#;;;;;;;;;;;;;;;!|||||||u$$amm[???????????????????????????????????????????????
//???????????????????????????????????????[$$$$$t?[$$$$$/???????????????????????M$#;;;;;;;;;;;;;;;!|||||||u$$amm[???????????????????????????????????????????????
//???????????????????????????????????????]%%%%%/?[%%%%%/???????????????????????M$#;;I!!;::;;;;;;;!//|||||u$$amm[???????????????????????????????????????????????
//?????????????????????????????????????????????????????????????????????????????M$#;;z$$: .;;;;;;;>YYx||||u$$amm[???????????????????????????????????????????????
//????????????????????????$$$$$j???????????????????????????????????????????????M$#;;z$$$$*;;;;;zYYYYx||||u$$amm[???????????????????????????????????????????????
//????????????????????????$$Mww|???????????????????????????????????????????????M$#;;|OOOOU;;;;;1(/YYx||||u$$amm[???????????????????????????????????????????????
//????????????????????????$$m??????????????????????????????????????????????????M$#;;;;;;;;;;;;;  ,YYx||||u$$amm[???????????????????????????????????????????????
//????????????????????????$$m??????????????????????????????????????????????????M$#;;;;;;;+$$v;;W$$$$Q||||u$$Y??????????????????????????????????????????????????
//????????????????????????$$m??????????????????????????????????????????????????M$#;;|OOi;!tt-;;zUUUUx||||u$$Y??????????????????????????????????????????????????
//????????????????????????$$m??????????????????????????????????????????????????M$#;;z$$<;;;;;;;)|||||||||u$$Y??????????????????????????????????????????????????
//?????????????????????k$$$$m????????????[$$$$$$$$$$0????????????{$$$$$(???????M$#;;;;;M$$$$$$$j|||||||||u$$Y??????????????????????????????????????????????????
//?????????????????????k$$$$m????????????[$$Z[[[[1$$0????????????{$$0[[????????M$@88v;;l!!!!|JJ&%*|||||&%B$$Y??????????????????????????????????????????????????
//?????????????????????d%%%%Z????????????[$$Z????[$$0????????????{$$Q??????????*%%%%c!!;;;;;)YY&%*||/tt&%%%%X??????????????????????????????????????????????????
//???????????????????????????????????????[$$Z????[$$0????????????{$$Q???????????????L$$<;;;;-|||||||m$${???????????????????????????????????????????????????????
//???????????????????????????????????????[$$Z????[$$0????????????{$$Q??????????????????W$$$$$$$$$$$$U??????????????????????????????????????????????????????????
//?????????????????????????????????????rvc$$Z??xvz$$0??????????xvX$$Q??????????????????Owd$$#ddB$%wwx??????????????????????????????????????????????????????????
//?????????????????????????????????????a$$$$Z??o$$$$0??????????#$$$$Q????????????????????($$0||8$#?????????????????????????????????????????????????????????????
//?????????????????????????????????????a$$$$Z??o$$$$0??????????#$$$$Q??????????????????,^>$$0||8$a^^i??????????????????????????????????????????????????????????
//?????????????????????????????????????rvvvvt??xvvvvt??????????xvvvv/??????????????????JQJ|||||||fQQj??????????????????????????????????????????????????????????
//?????????????????????????????????????????????????????????????????????????????????????W$o^^+||,^~$$U??????????????????????????????????????????????????????????
//??????????????????????????????????????????????????????????????????????????C$$$$$$$$$$$$*;;,^^aW&$$$$$$$$$$$$$[???????????????????????????????????????????????
//???????????????????????????????????????????????????????????????????????1%%8&&&&&&&&&&+!l;;u##WWW&&&&&jtu&&&&&%%h?????????????????????????????????????????????
//????????????????????????????????[[[[[[[[[[[[[[[[[[[[[]???????????????[[(88W##W&&&&&WW+llllzWWWWWWWWMMjtu&&&WW@@o[[]??????????????????????????????????????????
//???????????????????????????????]$$$$$$$$$$$$$$$$$$$$$/???????????????#$M;;;;;#$$$$%WWWWWWWWWWWWWWWC||%$$$$%WWWW&$$X??????????????????????????????????????????
//?????????????????????????????h$@qqqqqqqqqqqqqqqqqqqqq%$8?????????????#$@WW%$$)????L$$&WWWWL|||||||m$${????0$$t|u$$X??????????????????????????????????????????
//??????????????????????????)vvmddaadOOLCCCC0qqqqqqqqqq#W#vv/??????????#$%CCk$$Yvvvvp$$0C0WWwYYYYYYYk$${????0$$UYQ$$X??????????????????????????????????????????
//??????????????????????????c$$c|/$$aYYf||||cqqqqqqqqqqqqp$$Q??????????#$M;;c$$$$$$$$$$<;+WWWWWWWWWW%$${????0$$&W&$$X??????????????????????????????????????????
//????????????????????????$$Mqqx||||C$$v||||cqqqqqqqqqqqqqqqo$$|????J$$$$M;;c$$dqqqq*$$<;+WWWWWf|xWW%$${????0$$&W&$$X??????????????????????????????????????????
//?????????????????????Jwwaakqqx||ddZUUqdp||cqqqqqqqqqqqqqqqbaapwwwwdaaB$M;;c$$dqqqqbaaZOmWWWWWf|xWW%$${????0$$BBB$$X??????????????????????????????????????????
//?????????????????????k$$qqqqqx|/$$p||*$B||cqqqqqqqqqqqqqqqqqq%$$$$#qq%$M;;c$$dqqqqqqqB$@WWWWWf|xWW%$${????0$$$$$$$X??????????????????????????????????????????
//?????????????????????k$$qqqqqx||||||||||||cqqqqqqqt       {qqqqqqqqqqqq0;;tqqqqqqqqqqqqd$$%WWf|xWW%$${???????||)?????????????????????????????????????????????
//?????????????????????k$$qqqqqx|/%%%%%%%8||cqqqqwnnxrrrrt  .''''''''''''`;;"'''';qqqqqqqd$$OttoMMWW%$${???????||)?????????????????????xxt??/xx??{xx1??????????
//?????????????????????k$$qqqqqx|/%%BBB%%8||cqqqqwrrrxxrrt   ..        '``;;"``  ,qqqqqqqd$$0||oMWWW%$${???????||)?????????????????????uuj[[fuu[[)uu([[????????
//?????????????????????k$$qqqqqx||||rYYf||||cqqqqZ  <xx,    ~xx"       a$M;;c$$; ,qqqqqqqd$$0||XYLWW%$${???????||)?????????????????????$$$$$$$$$$$$$$$$????????
//?????????????????????k$$qqqqqqqqqqqqqqqqqqqqqqqwxxxxxxxj  ~xx" 'xxw$$_;<$$z;;#$%LLLLLnxuLLzxxCLJxxXLLnxY$$Q||%$*||q$$nxvLLzxxLLUxxxxx$$$$$1  $$$$$u??????????
//?????????????????????k$$qqqqqqqqqqqqqqqqqqqqqqqm[[|xx1[]  ~xx" 'xxQooxtrhhJttphbLLLLLnxuLLzxxCLJxxXLLnxz**mUUddqUUqoonxvLLzxxLLUxxxxx$$MLLj11$$&wwf??????????
//?????????????????????k$$qqqqqqqqqqqqqqqqqqqqqqqZ  <xx,    ~xx" 'xxcYY8$8xxw$$zxuLLLLLnxuLLzxxCLJxxXLLnxuLLa$$t|u$$pYYnxvLLzxxLLUxxxxx$$w  C$$$$b?????????????
//?????????????????????k$$qqqqqqqqqqqqqqqqqqqqqqqwxxxxxxxj  ~xx"    ?YY,         ,qqqqqqqd$$bUUUYYUUk$${???????||)?????????????????????$$$$$$$$$$b?????????????
//?????????????????????k$$qqqqq*WMqqkWWdqqqqqqqqqmii[xx+i!  "ii.    ,<<'         ,qqhWWWW#wwQUUUUUUUk$${???????uvr??|xx????????????????QQCvvJQQvvj?????????????
//?????????????????????k$$qqqqq8$@qqa$$kqqqqqqqqqZ  <xx,                         ,qq*$$$$8UUUUUUUUUUk$${???????XYv??rYY]???????????????xxf??/xx????????????????
//?????????????????????k$$qqqqqqqqqqqqqqqqqqqqqqqqqqt  |xj     Jqqqq0YYmqqqqqqqqqqqqqqqB$$$$$$$$$&UUk$${????????????rYY]???????????????????????????????????????
//?????????????????????k$$qqqqqqqqqqqqqqqqqqLnnOqqqqwZZl.`rrXZZwqqqqqwwqqqqqqqqqqqqqqqqppb$$C[[&$&UUk$${???????zXu??]]]????????????????????????????????????????
//?????????????????????k$$qqqqqqqqppqqqpppqqLxxOqqqqqqq!'^nnUwwqqqqqqpppppqqqqqqqqqqqqqqqd$$C[[&$&UUk$${???????zXu??]]]????????????????????????????????????????
//?????????????????????k$$qqqqqqqq$$Mqq8$@qqLxxOqqqqqqqqqqqqCxxZqqqq*$$$$Bqqqqqqqqqqqqqqqd$$$$$$$&UUk$${????????????rYY]???????????????????????????????????????
//????????????????????????$$MqqqqqqqqqqqqqqqLxxOqqqqqqqqqqqqo$$$$$$$Q????1$$$$$dqqqqqqqqqqqq#$$$$&UUk$${???????????????????????????????????????????????????????
//????????????????????????wwdaaaaaqqqqqqqqqq0YYmqqqqqqqhaaaabwwwwwwwX||]?{wwwwwhaaaaaaaaaaaaW$$$$Wvvd$${???????????????????????????????????????????????????????
//??????????????????????????c$$$$@qqqqqqqqqqqqqqqqqqqqq%$$$$Q???????tYY}???????M$$$$$$$$$$$$$$$$$M||m$${???????????????????????????????????????????????????????
//???????????????????????????????]$$$$$kqqqqqqqqqqqqo$$/????????????????????????????L$$LUQ$$J??&$&YYk$${???????????????????????????????????????????????????????
//????????????????????????????????vvvvvhWWWWWWWWWWWWqvv}????????????(xx[????????????L$$LUQ$$J??&$&YYk$${???????????????????????????????????????????????????????
//?????????????????????????????????????a$$$$$$$$$$$$0???????????????tYY}????????????L$$LUQ$$J??&$&YYk$${???????????????????????????????????????????????????????
//??????????????????????????????????????????????????????????????????????????????????L$$LUQ$$J??&$&UUk$${???????????????????????????????????????????????????????
//??????????????????????????????????????????????????????????????????????????????????L$$BBB$$J??&$&UUk$${???????????????????????????????????????????????????????
//??????????????????????????????????????????????????????????????????????????????????J%%888%%U??M%MYYb%%}???????????????????????????????????????????????????????
//?????????????????????????????????????????????????????????????????????????????????????I;I???????]||{??????????????????????????????????????????????????????????
//???????????????????????????????????????????????????????????????????????????????-;;;;;;;I??{|||||||{??????????????????????????????????????????????????????????
//???????????????????????????????????????????????????????????????????????????????-iiiiiii>??}1111111[??????????????????????????????????????????????????????????

//ZOMBIEBITS ROCKS!
//contract created by ZombieBits @ZombieBitsNFT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}



// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}


// OpenZeppelin Contracts v4.4.1 (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }
        }
        return computedHash;
    }
}

pragma solidity ^0.8.13;

interface IOperatorFilterRegistry {
    function isOperatorAllowed(address registrant, address operator) external view returns (bool);
    function register(address registrant) external;
    function registerAndSubscribe(address registrant, address subscription) external;
    function registerAndCopyEntries(address registrant, address registrantToCopy) external;
    function unregister(address addr) external;
    function updateOperator(address registrant, address operator, bool filtered) external;
    function updateOperators(address registrant, address[] calldata operators, bool filtered) external;
    function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external;
    function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external;
    function subscribe(address registrant, address registrantToSubscribe) external;
    function unsubscribe(address registrant, bool copyExistingEntries) external;
    function subscriptionOf(address addr) external returns (address registrant);
    function subscribers(address registrant) external returns (address[] memory);
    function subscriberAt(address registrant, uint256 index) external returns (address);
    function copyEntriesOf(address registrant, address registrantToCopy) external;
    function isOperatorFiltered(address registrant, address operator) external returns (bool);
    function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool);
    function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool);
    function filteredOperators(address addr) external returns (address[] memory);
    function filteredCodeHashes(address addr) external returns (bytes32[] memory);
    function filteredOperatorAt(address registrant, uint256 index) external returns (address);
    function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32);
    function isRegistered(address addr) external returns (bool);
    function codeHashOf(address addr) external returns (bytes32);
}

pragma solidity ^0.8.13;


/**
 * @title  OperatorFilterer
 * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another
 *         registrant's entries in the OperatorFilterRegistry.
 * @dev    This smart contract is meant to be inherited by token contracts so they can use the following:
 *         - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods.
 *         - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
 */
abstract contract OperatorFilterer {
    error OperatorNotAllowed(address operator);

    IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY =
        IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E);

    constructor(address subscriptionOrRegistrantToCopy, bool subscribe) {
        // If an inheriting token contract is deployed to a network without the registry deployed, the modifier
        // will not revert, but the contract will need to be registered with the registry once it is deployed in
        // order for the modifier to filter addresses.
        if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
            if (subscribe) {
                OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy);
            } else {
                if (subscriptionOrRegistrantToCopy != address(0)) {
                    OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy);
                } else {
                    OPERATOR_FILTER_REGISTRY.register(address(this));
                }
            }
        }
    }

    modifier onlyAllowedOperator(address from) virtual {
        // Allow spending tokens from addresses with balance
        // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
        // from an EOA.
        if (from != msg.sender) {
            _checkFilterOperator(msg.sender);
        }
        _;
    }

    modifier onlyAllowedOperatorApproval(address operator) virtual {
        _checkFilterOperator(operator);
        _;
    }

    function _checkFilterOperator(address operator) internal view virtual {
        // Check registry code length to facilitate testing in environments without a deployed registry.
        if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) {
            if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) {
                revert OperatorNotAllowed(operator);
            }
        }
    }
}

pragma solidity ^0.8.13;


/**
 * @title  DefaultOperatorFilterer
 * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription.
 */
abstract contract DefaultOperatorFilterer is OperatorFilterer {
    address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6);

    constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {}
}


// 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;
    }
}


// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}


// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)


pragma solidity ^0.8.0;


/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}



// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}


// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)



// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}


// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;


/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}









pragma solidity ^0.8.0;

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

    // Mapping from account to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC1155).interfaceId ||
            interfaceId == type(IERC1155MetadataURI).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @dev See {IERC1155-balanceOf}.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
        require(account != address(0), "ERC1155: balance query for the zero address");
        return _balances[id][account];
    }

    /**
     * @dev See {IERC1155-balanceOfBatch}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
        public
        view
        virtual
        override
        returns (uint256[] memory)
    {
        require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");

        uint256[] memory batchBalances = new uint256[](accounts.length);

        for (uint256 i = 0; i < accounts.length; ++i) {
            batchBalances[i] = balanceOf(accounts[i], ids[i]);
        }

        return batchBalances;
    }

    /**
     * @dev See {IERC1155-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC1155-isApprovedForAll}.
     */
    function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[account][operator];
    }

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );
        _safeTransferFrom(from, to, id, amount, data);
    }

    /**
     * @dev See {IERC1155-safeBatchTransferFrom}.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: transfer caller is not owner nor approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC1155: setting approval status for self");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    function _doSafeTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155Receiver.onERC1155Received.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _doSafeBatchTransferAcceptanceCheck(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) private {
        if (to.isContract()) {
            try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}


pragma solidity >=0.7.0 <0.9.0;

contract ZombieBitsROCKS is DefaultOperatorFilterer, ERC1155, Ownable {

  //sets max immutable total supply of all collection
  uint public constant MAX_TOKENS = 100000;
  //start collection at 0 minted
  uint public numMinted = 0;
  //sets the max tokens for current range mint function
  uint public MAX_QTY_for_RANGE = 0;
//sets the max tokens for current range gated mint function
  uint public MAX_QTY_for_RANGE_GATED = 0;
  //sets price for range function
  uint public PRICE_RANGE_MINT_PRICE = 0 ether;
  //sets price for range function
  uint public PRICE_GATED_RANGE_MINT_PRICE = 0 ether;
  //sets the lowest token allowed in range
  uint public low = 0;
//sets the highest token allowed in range
  uint public high = 0;

  //sets the lowest token allowed in range gated
  uint public lowGATED = 0;
//sets the highest token allowed in range gated
  uint public highGATED = 0;

//set the max per wallet for range mint when tracker set to 69
  uint public MAX_PER_WALLET_RANGE_MINT = 0;

  //set the max per wallet for gated range mint when tracker set to 69
  uint public MAX_PER_WALLET_RANGE_GATED_MINT = 0;

//set to 1 for flexible per wallet address loads-- set to 69 for one set max per wallet
  uint public CURRENT_WALLET_TRACK_LIST_RANGE = 0;

  uint public CURRENT_WALLET_TRACK_LIST_RANGE_GATED = 0;


//set to 69 for shared max per wallet of any of the 10 editions slots, set to 2 for flexible per wallet address shared, set to 1 to use wallet tracking slots 1-10
  uint public CURRENT_WALLET_TRACK_LIST_MULTI_SALE = 1;

  uint public MAX_PER_WALLET_MULTI_MINT_E1 = 1;

  uint public MAX_PER_WALLET_MULTI_MINT_E2 = 0;

  uint public MAX_PER_WALLET_MULTI_MINT_E3 = 0;

  uint public MAX_PER_WALLET_MULTI_MINT_E4 = 0;

  uint public MAX_PER_WALLET_MULTI_MINT_E5 = 0;

  uint public MAX_PER_WALLET_MULTI_MINT_E6 = 0;

  uint public MAX_PER_WALLET_MULTI_MINT_E7 = 0;

  uint public MAX_PER_WALLET_MULTI_MINT_E8 = 0;

  uint public MAX_PER_WALLET_MULTI_MINT_E9 = 0;

  uint public MAX_PER_WALLET_MULTI_MINT_E10 = 0;

  uint public MAX_PER_WALLET_MULTI_MINT_SHARED = 0;

  uint public MAX_MINTS_PER_TX_RANGE = 0;

  uint public MAX_MINTS_PER_TX_RANGE_GATED = 0;

  uint public MAX_MINTS_PER_TX_E1 = 1;

  uint public MAX_MINTS_PER_TX_E2 = 0;

  uint public MAX_MINTS_PER_TX_E3 = 0;

  uint public MAX_MINTS_PER_TX_E4 = 0;

  uint public MAX_MINTS_PER_TX_E5 = 0;

  uint public MAX_MINTS_PER_TX_E6 = 0;

  uint public MAX_MINTS_PER_TX_E7 = 0;

  uint public MAX_MINTS_PER_TX_E8 = 0;

  uint public MAX_MINTS_PER_TX_E9 = 0;

  uint public MAX_MINTS_PER_TX_E10 = 0;




//sets the current token IDs (editions) that are available in current minting using MULTI mintCLAIMfromAvail function
  //if not using all slots- set the others to 0 and make sure to set 0 max supply qty for each
  uint public E1 = 1;
  uint public E2 = 0;
  uint public E3 = 0;
  uint public E4 = 0;
  uint public E5 = 0;
  uint public E6 = 0;
  uint public E7 = 0;
  uint public E8 = 0;
  uint public E9 = 0;
  uint public E10 = 0;

//sets max supply of each 10 current IDs during the current minting (if not using all 10 spots- set the others to 0)
  uint public maxE1 = 969;
  uint public maxE2 = 0;
  uint public maxE3 = 0;
  uint public maxE4 = 0;
  uint public maxE5 = 0;
  uint public maxE6 = 0;
  uint public maxE7 = 0;
  uint public maxE8 = 0;
  uint public maxE9 = 0;
  uint public maxE10 = 0;

//sets price of each 10 current IDs minting
  uint public priceE1 = 0 ether;
  uint public priceE2 = 0 ether;
  uint public priceE3 = 0 ether;
  uint public priceE4 = 0 ether;
  uint public priceE5 = 0 ether;
  uint public priceE6 = 0 ether;
  uint public priceE7 = 0 ether;
  uint public priceE8 = 0 ether;
  uint public priceE9 = 0 ether;
  uint public priceE10 = 0 ether;


   bytes32 public Merkle1;
    bytes32 public Merkle2;
     bytes32 public Merkle3;
      bytes32 public Merkle4;
       bytes32 public Merkle5;
        bytes32 public Merkle6;
         bytes32 public Merkle7;
          bytes32 public Merkle8;
           bytes32 public Merkle9;
            bytes32 public Merkle10;

  bytes32 public MerkleRange;

  // Sale state:
  // 0: Closed
  // 1: Open 
  uint256 public SALE_STATUS_MINT_RANGE_SALE = 0;
  uint256 public SALE_STATUS_MINT_MULTI_SALE = 0;
  uint256 public SALE_STATUS_GATED_RANGE_SALE = 0;
  uint256 public SALE_STATUS_MINT_MULTI_SALE_GATED=1;

  string private _contractUri = "ipfs://QmczSCQBaR5NAf7yeM2JT7roC3yWqTvkBoPmvciL2eHUfN";

  string public name = "ZombieBitsROCKS";
  string public symbol = "ZBITSROCKS";

 mapping (address => uint256) public FLEX_ALLOWED_PER_WALLET_RANGE_MINT;

 mapping (address => uint256) public FLEX_ALLOWED_PER_WALLET_RANGE_GATED_MINT;

 mapping (address => uint256) public FLEX_ALLOWED_PER_WALLET_MULTI_MINT_SHARED;


 address private BurnerContract;

 address private BurnerContract2;

 address private BurnerContract3;

 address private BurnerContract4;

 address private BurnerContract5;


    

    //10 flexible slots to use in flex and re-use each time
    mapping (address => uint) public MultiNumMinted1;
    mapping (address => uint) public MultiNumMinted2;
    mapping (address => uint) public MultiNumMinted3;
    mapping (address => uint) public MultiNumMinted4;
    mapping (address => uint) public MultiNumMinted5;
    mapping (address => uint) public MultiNumMinted6;
    mapping (address => uint) public MultiNumMinted7;
    mapping (address => uint) public MultiNumMinted8;
    mapping (address => uint) public MultiNumMinted9;
    mapping (address => uint) public MultiNumMinted10;
    mapping (address => uint) public MultiNumMinted_SHARED;
    mapping (address => uint) public NumMinted_FLEX_RANGE;
    mapping (address => uint) public NumMinted_FLEX_RANGE_GATED;
    


  constructor() public ERC1155("ipfs://QmNr8gx8HDUSF7FWMN2oD8kDfHcTZNeuNbUwEZgwQjbMEr/{id}.json") {}
    

  //allows minting of RANGE of tokens i.e 1-20 with a set SHARED total supply and SHARED price
  function mintRANGE(uint EditionNum, uint amount) public payable {
    require(SALE_STATUS_MINT_RANGE_SALE == 1, "not open");
    _internalMintRange(EditionNum, amount);
  }

   function GATEDmintRANGE(uint EditionNum, uint amount, bytes32[] calldata MerkleProofRange) public payable {
    require(SALE_STATUS_GATED_RANGE_SALE == 1, "not open");
    bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
        require(MerkleProof.verify(MerkleProofRange, MerkleRange, leaf), "Invalid proof.");
    _internalMintGatedRange(EditionNum, amount);
  }

  //allows minting of 10 different editions as defined by e1, e2, e3, etc with diff prices and supplies
  function mintCLAIM_fromAvail_MULTI(uint EditionNum, uint amount) public payable {
    require(SALE_STATUS_MINT_MULTI_SALE == 1, "not open");
    _internalMintAvail(EditionNum, amount);
  }

//if minting same edition number/token ID as the non gated mint--- the wallet tracker will use the same slot --- USE RANGE MINT FOR ONE INSTEAD
  function GATEDmintCLAIMfromAvail_MULTI(uint EditionNum, uint amount, bytes32[] calldata MerkleProofMulti) public payable {
    require(SALE_STATUS_MINT_MULTI_SALE_GATED == 1, "not open");
    _internalMerkleGrab(EditionNum, MerkleProofMulti);
    _internalMintAvail(EditionNum, amount);
  }


  function _internalMintRange(uint EditionNum, uint amount) internal {
    incrementNumMinted(amount);
    if (EditionNum > 0) {
      checkPayment(PRICE_RANGE_MINT_PRICE * amount);
      _checkEditionRange(amount, EditionNum);
    require (amount <= MAX_MINTS_PER_TX_RANGE, "invalid quantity: zero or greater than mint allowance per tx");  
    } else {
      revert("Invalid pass type");
    }
    _mint(msg.sender, EditionNum, amount, "");
  }

  function _internalMintGatedRange(uint EditionNum, uint amount) internal {
    incrementNumMinted(amount);
    if (EditionNum > 0) {
      checkPayment(PRICE_GATED_RANGE_MINT_PRICE * amount);
      _checkEditionGATEDRange(amount, EditionNum);
      require (amount <= MAX_MINTS_PER_TX_RANGE_GATED, "invalid quantity: zero or greater than mint allowance per tx");
    } else {
      revert("Invalid pass type");
    }
    _mint(msg.sender, EditionNum, amount, "");
  }

   function _checkEditionRange(uint256 amount, uint EditionNum) internal {
    require(EditionNum >= low, "not in range");
    require(EditionNum <= high, "not in range");
    require(amount > 0 && amount <= MAX_QTY_for_RANGE, "exceed");
    MAX_QTY_for_RANGE -= amount; 
    _checkCURRENT_WALLET_TRACK_LIST_RANGE(amount);
  }

  

  function _internalMintAvail(uint EditionNum, uint amount) internal {
    incrementNumMinted(amount);
    if (EditionNum == E1) {
      checkPayment(priceE1 * amount);
      require(EditionNum == E1, "wrong id");
    require(amount > 0 && amount <= maxE1, "exceed");
    maxE1 -= amount;
    require (amount <= MAX_MINTS_PER_TX_E1, "invalid quantity: zero or greater than mint allowance per tx");
      _checkCURRENT_WALLET_TRACK_LIST_MULTI_SALE(EditionNum, amount);
      
    }
    else if (EditionNum == E2) {
        checkPayment(priceE2 * amount);
        require(EditionNum == E2, "wrong id");
    require(amount > 0 && amount <= maxE2, "exceed");
    maxE2 -= amount;
    require (amount <= MAX_MINTS_PER_TX_E2, "exceed");
        _checkCURRENT_WALLET_TRACK_LIST_MULTI_SALE(EditionNum, amount);
    } 
    else if (EditionNum == E3) {
        checkPayment(priceE3 * amount);
        require(EditionNum == E3, "wrong id");
    require(amount > 0 && amount <= maxE3, "exceed");
    maxE3 -= amount;
    require (amount <= MAX_MINTS_PER_TX_E3, "exceed");
        _checkCURRENT_WALLET_TRACK_LIST_MULTI_SALE(EditionNum, amount);
    }
    else if (EditionNum == E4) {
        checkPayment(priceE4 * amount);
        require(EditionNum == E4, "wrong id");
    require(amount > 0 && amount <= maxE4, "exceed");
    maxE4 -= amount;
    require (amount <= MAX_MINTS_PER_TX_E4, "exceed");
        _checkCURRENT_WALLET_TRACK_LIST_MULTI_SALE(EditionNum, amount);
    }
    else if (EditionNum == E5) {
        checkPayment(priceE5 * amount);
        require(EditionNum == E5, "wrong id");
    require(amount > 0 && amount <= maxE5, "exceed");
    maxE5 -= amount;
    require (amount <= MAX_MINTS_PER_TX_E5, "exceed");
        _checkCURRENT_WALLET_TRACK_LIST_MULTI_SALE(EditionNum, amount);
    }
    else if (EditionNum == E6) {
        checkPayment(priceE6 * amount);
        require(EditionNum == E6, "wrong id");
    require(amount > 0 && amount <= maxE6, "exceed");
    maxE6 -= amount; 
    require (amount <= MAX_MINTS_PER_TX_E6, "exceed");
        _checkCURRENT_WALLET_TRACK_LIST_MULTI_SALE(EditionNum, amount);
    }
    else if (EditionNum == E7) {
        checkPayment(priceE7 * amount);
        require(EditionNum == E7, "wrong id");
    require(amount > 0 && amount <= maxE7, "exceed");
    maxE7 -= amount;
    require (amount <= MAX_MINTS_PER_TX_E7, "exceed");
        _checkCURRENT_WALLET_TRACK_LIST_MULTI_SALE(EditionNum, amount);
    }
    else if (EditionNum == E8) {
        checkPayment(priceE8 * amount);
        require(EditionNum == E8, "wrong id");
    require(amount > 0 && amount <= maxE8, "exceed");
    maxE8 -= amount;
    require (amount <= MAX_MINTS_PER_TX_E8, "exceed");
        _checkCURRENT_WALLET_TRACK_LIST_MULTI_SALE(EditionNum, amount);
    }
    else if (EditionNum == E9) {
        checkPayment(priceE9 * amount);
        require(EditionNum == E9, "wrong id");
    require(amount > 0 && amount <= maxE9, "exceed");
    maxE9 -= amount;
    require (amount <= MAX_MINTS_PER_TX_E9, "exceed");
        _checkCURRENT_WALLET_TRACK_LIST_MULTI_SALE(EditionNum, amount);
    }
    else if (EditionNum == E10) {
        checkPayment(priceE10 * amount);
        require(EditionNum == E10, "wrong id");
    require(amount > 0 && amount <= maxE10, "exceed");
    maxE10 -= amount;
    require (amount <= MAX_MINTS_PER_TX_E10, "exceed");
        _checkCURRENT_WALLET_TRACK_LIST_MULTI_SALE(EditionNum, amount);
    }
    
    else {
      revert("Invalid pass type");
    }
    _mint(msg.sender, EditionNum, amount, "");
  }

function _internalMerkleGrab(uint EditionNum, bytes32[] calldata MerkleProofMulti) internal view {
  bytes32 leaf = keccak256(abi.encodePacked(msg.sender));
    if (EditionNum == E1) {
     
        require(MerkleProof.verify(MerkleProofMulti, Merkle1, leaf), "Invalid proof.");
      
    }
    else if (EditionNum == E2) {
      
        require(MerkleProof.verify(MerkleProofMulti, Merkle2, leaf), "Invalid proof."); 
    } 
    else if (EditionNum == E3) {
      
        require(MerkleProof.verify(MerkleProofMulti, Merkle3, leaf), "Invalid proof.");  
    }
    else if (EditionNum == E4) {
      
        require(MerkleProof.verify(MerkleProofMulti, Merkle4, leaf), "Invalid proof.");  
    }
    else if (EditionNum == E5) {
      
        require(MerkleProof.verify(MerkleProofMulti, Merkle5, leaf), "Invalid proof.");  
    }
    else if (EditionNum == E6) {
        
        require(MerkleProof.verify(MerkleProofMulti, Merkle6, leaf), "Invalid proof.");
    }
    else if (EditionNum == E7) {
        
        require(MerkleProof.verify(MerkleProofMulti, Merkle7, leaf), "Invalid proof.");
    }
    else if (EditionNum == E8) {
        
        require(MerkleProof.verify(MerkleProofMulti, Merkle8, leaf), "Invalid proof.");
    }
    else if (EditionNum == E9) {
       
        require(MerkleProof.verify(MerkleProofMulti, Merkle9, leaf), "Invalid proof."); 
    }
    else if (EditionNum == E10) {
        
        require(MerkleProof.verify(MerkleProofMulti, Merkle10, leaf), "Invalid proof.");
    }
    else {
      revert("Invalid pass type");
    }
}


    function checkPayment(uint amountRequired) internal {
    require(msg.value >= amountRequired, "Not enough funds sent");
  }

  function incrementNumMinted(uint amount) internal {
    numMinted = numMinted + amount;
    require(numMinted <= MAX_TOKENS, "exceed");
  }


function _checkCURRENT_WALLET_TRACK_LIST_MULTI_SALE(uint EditionNum, uint256 amount) internal {
  if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 1 && EditionNum == E1){
    MultiNumMinted1[msg.sender] = MultiNumMinted1[msg.sender] + amount;
        require(MultiNumMinted1[msg.sender] <= MAX_PER_WALLET_MULTI_MINT_E1, "exceed");
  }
  else if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 1 && EditionNum == E2){
    MultiNumMinted2[msg.sender] = MultiNumMinted2[msg.sender] + amount;
        require(MultiNumMinted2[msg.sender] <= MAX_PER_WALLET_MULTI_MINT_E2, "exceed");
  }
  else if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 1 && EditionNum == E3){
    MultiNumMinted3[msg.sender] = MultiNumMinted3[msg.sender] + amount;
        require(MultiNumMinted3[msg.sender] <= MAX_PER_WALLET_MULTI_MINT_E3, "exceed");
  }
  else if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 1 && EditionNum == E4){
    MultiNumMinted4[msg.sender] = MultiNumMinted4[msg.sender] + amount;
        require(MultiNumMinted4[msg.sender] <= MAX_PER_WALLET_MULTI_MINT_E4, "exceed");
  }
  else if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 1 && EditionNum == E5){
    MultiNumMinted5[msg.sender] = MultiNumMinted5[msg.sender] + amount;
        require(MultiNumMinted5[msg.sender] <= MAX_PER_WALLET_MULTI_MINT_E5, "exceed");
  }
  else if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 1 && EditionNum == E6){
    MultiNumMinted6[msg.sender] = MultiNumMinted6[msg.sender] + amount;
        require(MultiNumMinted6[msg.sender] <= MAX_PER_WALLET_MULTI_MINT_E6, "exceed");
  }
  else if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 1 && EditionNum == E7){
    MultiNumMinted7[msg.sender] = MultiNumMinted7[msg.sender] + amount;
        require(MultiNumMinted7[msg.sender] <= MAX_PER_WALLET_MULTI_MINT_E7, "exceed");
  }
  else if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 1 && EditionNum == E8){
    MultiNumMinted8[msg.sender] = MultiNumMinted8[msg.sender] + amount;
        require(MultiNumMinted8[msg.sender] <= MAX_PER_WALLET_MULTI_MINT_E8, "exceed");
  }
  else if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 1 && EditionNum == E9){
    MultiNumMinted9[msg.sender] = MultiNumMinted9[msg.sender] + amount;
        require(MultiNumMinted9[msg.sender] <= MAX_PER_WALLET_MULTI_MINT_E9, "exceed");
  }
  else if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 1 && EditionNum == E10){
    MultiNumMinted10[msg.sender] = MultiNumMinted10[msg.sender] + amount;
        require(MultiNumMinted10[msg.sender] <= MAX_PER_WALLET_MULTI_MINT_E10, "exceed");
  }
  else if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 69 && EditionNum > 0){
    MultiNumMinted_SHARED[msg.sender] = MultiNumMinted_SHARED[msg.sender] + amount;
        require(MultiNumMinted_SHARED[msg.sender] <= MAX_PER_WALLET_MULTI_MINT_SHARED, "exceed");
  }
  else if (CURRENT_WALLET_TRACK_LIST_MULTI_SALE == 2 && EditionNum > 0){
    MultiNumMinted_SHARED[msg.sender] = MultiNumMinted_SHARED[msg.sender] + amount;
    require(MultiNumMinted_SHARED[msg.sender] <= FLEX_ALLOWED_PER_WALLET_MULTI_MINT_SHARED[msg.sender], "exceed")
  ;}
  else {
      revert("Invalid");
    }

}

//
  function _checkEditionGATEDRange(uint256 amount, uint EditionNum) internal {
    require(EditionNum >= lowGATED, "not in range");
    require(EditionNum <= highGATED, "not in range");
    require(amount > 0 && amount <= MAX_QTY_for_RANGE_GATED, "exceed");
    MAX_QTY_for_RANGE_GATED -= amount; 
    _checkCURRENT_WALLET_TRACK_LIST_RANGE_GATED(amount);
  }

//choose 1- this allows range mint with an adjustable max PER WALLET & PER ADDRESS
  function _checkCURRENT_WALLET_TRACK_LIST_RANGE(uint256 amount) internal {
    if (CURRENT_WALLET_TRACK_LIST_RANGE == 1){
    NumMinted_FLEX_RANGE[msg.sender] = NumMinted_FLEX_RANGE[msg.sender] + amount;
    require(NumMinted_FLEX_RANGE[msg.sender] <= FLEX_ALLOWED_PER_WALLET_RANGE_MINT[msg.sender], "exceed")
  ;}
  //choose 69-this allows use of the ADJUSTABLE FLEX max per wallet - STANDARD ACROSS ALL WALLETS
  ////Reset NumMinted_FLEX_ranges to zero before re-using
  else if (CURRENT_WALLET_TRACK_LIST_RANGE == 69){
    NumMinted_FLEX_RANGE[msg.sender] = NumMinted_FLEX_RANGE[msg.sender] + amount;
    require(NumMinted_FLEX_RANGE[msg.sender] <= MAX_PER_WALLET_RANGE_MINT, "exceed")
  ;}
  else {
      revert("Invalid");
    }

}

function _checkCURRENT_WALLET_TRACK_LIST_RANGE_GATED(uint256 amount) internal {
    if (CURRENT_WALLET_TRACK_LIST_RANGE_GATED == 1){
    NumMinted_FLEX_RANGE_GATED[msg.sender] = NumMinted_FLEX_RANGE_GATED[msg.sender] + amount;
    require(NumMinted_FLEX_RANGE_GATED[msg.sender] <= FLEX_ALLOWED_PER_WALLET_RANGE_GATED_MINT[msg.sender], "exceed")
  ;}
  //choose 69-this allows use of the ADJUSTABLE FLEX max per wallet - standard across all wallets
  ////Reset NumMinted_FLEX_RANGE_GATEDs to zero before re-using
  else if (CURRENT_WALLET_TRACK_LIST_RANGE_GATED == 69){
    NumMinted_FLEX_RANGE_GATED[msg.sender] = NumMinted_FLEX_RANGE_GATED[msg.sender] + amount;
    require(NumMinted_FLEX_RANGE_GATED[msg.sender] <= MAX_PER_WALLET_RANGE_GATED_MINT, "exceed")
  ;}
  else {
      revert("Invalid");
    }

}


//super dev owner mint--- ONLY ONE THAT CAN MINT EDITION #0 TOKENS
  function ownerMint(uint EditionNum, uint amount) public onlyOwner {
    incrementNumMinted(amount);
    _mint(msg.sender, EditionNum, amount, "");
  }


//withdraw funds
  function withdraw() public onlyOwner {
    uint balance = address(this).balance;
    payable(msg.sender).transfer(balance);
  }

  function setBaseUri(string calldata newUri) public onlyOwner {
    _setURI(newUri);
  }

  function setContractUri(string calldata newUri) public onlyOwner {
    _contractUri = newUri;
  }


//function to set wallet tracker lists
function setWALLET_TRACKERS(uint newCURRENT_WALLET_TRACK_LIST_RANGE, uint newCURRENT_WALLET_TRACK_LIST_RANGE_GATED, uint newCURRENT_WALLET_TRACK_LIST_MULTI_SALE) public onlyOwner {
    CURRENT_WALLET_TRACK_LIST_RANGE = newCURRENT_WALLET_TRACK_LIST_RANGE;
     CURRENT_WALLET_TRACK_LIST_RANGE_GATED = newCURRENT_WALLET_TRACK_LIST_RANGE_GATED;
      CURRENT_WALLET_TRACK_LIST_MULTI_SALE = newCURRENT_WALLET_TRACK_LIST_MULTI_SALE;

}

//set the prices for range mints
  function setPRICE_RANGE_MINT_PRICES(uint newPRICE_RANGE_MINT_PRICE, uint newPRICE_GATED_RANGE_MINT_PRICE) public onlyOwner {
    PRICE_RANGE_MINT_PRICE = newPRICE_RANGE_MINT_PRICE;
    PRICE_GATED_RANGE_MINT_PRICE = newPRICE_GATED_RANGE_MINT_PRICE;
  }

//used to set the low and high for range and gated range
  function setLOW_HIGHS(uint newLOW, uint newHIGH, uint newLOWgated, uint newHIGHgated) public onlyOwner {
    low = newLOW;
    high = newHIGH;
    lowGATED = newLOWgated;
    highGATED = newHIGHgated;
  }

   function setMAX_MINTS_PER_TXS(uint newMAX_MINTS_PER_TX_E10, uint newMAX_MINTS_PER_TX_E9, uint newMAX_MINTS_PER_TX_E8, uint newMAX_MINTS_PER_TX_E7, uint newMAX_MINTS_PER_TX_E6, uint newMAX_MINTS_PER_TX_E5, uint newMAX_MINTS_PER_TX_E4, uint newMAX_MINTS_PER_TX_E3, uint newMAX_MINTS_PER_TX_E2, uint newMAX_MINTS_PER_TX_E1, uint newMAX_MINTS_PER_TX_RANGE, uint newMAX_MINTS_PER_TX_RANGE_GATED) public onlyOwner {
    MAX_MINTS_PER_TX_RANGE = newMAX_MINTS_PER_TX_RANGE;
    MAX_MINTS_PER_TX_RANGE_GATED = newMAX_MINTS_PER_TX_RANGE_GATED;
    MAX_MINTS_PER_TX_E1 = newMAX_MINTS_PER_TX_E1;
    MAX_MINTS_PER_TX_E1 = newMAX_MINTS_PER_TX_E2;
    MAX_MINTS_PER_TX_E1 = newMAX_MINTS_PER_TX_E3;
    MAX_MINTS_PER_TX_E1 = newMAX_MINTS_PER_TX_E4;
    MAX_MINTS_PER_TX_E1 = newMAX_MINTS_PER_TX_E5;
    MAX_MINTS_PER_TX_E1 = newMAX_MINTS_PER_TX_E6;
    MAX_MINTS_PER_TX_E1 = newMAX_MINTS_PER_TX_E7;
    MAX_MINTS_PER_TX_E1 = newMAX_MINTS_PER_TX_E8;
    MAX_MINTS_PER_TX_E1 = newMAX_MINTS_PER_TX_E9;
    MAX_MINTS_PER_TX_E1 = newMAX_MINTS_PER_TX_E10;
    
  }



 /// @notice sets the token ID/edition number signed to each of the 10 slots during active mint (set to zero for unused- only owner can mint TOKEN 0)
  function setE1(uint newE1, uint newE2, uint newE3, uint newE4, uint newE5, uint newE6, uint newE7, uint newE8, uint newE9, uint newE10) public onlyOwner {
    E1 = newE1;
    E2 = newE2;
    E3 = newE3;
    E4 = newE4;
    E5 = newE5;
    E6 = newE6;
    E7 = newE7;
    E8 = newE8;
    E9 = newE9;
    E10 = newE10;

  }

//sets the max tokens allowed for that edition during mint
   function setmax(uint newmaxE1, uint newmaxE2, uint newmaxE3, uint newmaxE4, uint newmaxE5, uint newmaxE6, uint newmaxE7, uint newmaxE8, uint newmaxE9, uint newmaxE10) public onlyOwner {
    maxE1 = newmaxE1;
    maxE2 = newmaxE2;
    maxE3 = newmaxE3;
    maxE4 = newmaxE4;
    maxE5 = newmaxE5;
    maxE6 = newmaxE6;
    maxE7 = newmaxE7;
    maxE8 = newmaxE8;
    maxE9 = newmaxE9;
    maxE10 = newmaxE10;
  }

//sets the price for each edition slot
  function setpriceE1(uint newpriceE1, uint newpriceE2, uint newpriceE3, uint newpriceE4, uint newpriceE5, uint newpriceE6, uint newpriceE7, uint newpriceE8, uint newpriceE9, uint newpriceE10) public onlyOwner {
    priceE1 = newpriceE1;
    priceE2 = newpriceE2;
    priceE3 = newpriceE3;
    priceE4 = newpriceE4;
    priceE5 = newpriceE5;
    priceE6 = newpriceE6;
    priceE7 = newpriceE7;
    priceE8 = newpriceE8;
    priceE9 = newpriceE9;
    priceE10 = newpriceE10;
  }


//sets the max qty for the range and gated range mints
  function set_MAX_QTY_for_RANGE_MINTS(uint newMAXrangeQty, uint newMAXrangeGatedQty) public onlyOwner {
    MAX_QTY_for_RANGE = newMAXrangeQty;
    MAX_QTY_for_RANGE_GATED = newMAXrangeGatedQty;
  }

//sets the max per wallet for each edition slot
   function setMAX_PER_WALLET_MULTI_MINT_EDITIONS(uint newMAX_PER_WALLET_MULTI_MINT_SHARED, uint newMAX_PER_WALLET_MULTI_MINT_E1, uint newMAX_PER_WALLET_MULTI_MINT_E2, uint newMAX_PER_WALLET_MULTI_MINT_E3, uint newMAX_PER_WALLET_MULTI_MINT_E4, uint newMAX_PER_WALLET_MULTI_MINT_E5, uint newMAX_PER_WALLET_MULTI_MINT_E6, uint newMAX_PER_WALLET_MULTI_MINT_E7, uint newMAX_PER_WALLET_MULTI_MINT_E8, uint newMAX_PER_WALLET_MULTI_MINT_E9, uint newMAX_PER_WALLET_MULTI_MINT_E10) public onlyOwner {
    MAX_PER_WALLET_MULTI_MINT_E1 = newMAX_PER_WALLET_MULTI_MINT_E1;
    MAX_PER_WALLET_MULTI_MINT_E2 = newMAX_PER_WALLET_MULTI_MINT_E2;
    MAX_PER_WALLET_MULTI_MINT_E3 = newMAX_PER_WALLET_MULTI_MINT_E3;
    MAX_PER_WALLET_MULTI_MINT_E4 = newMAX_PER_WALLET_MULTI_MINT_E4;
    MAX_PER_WALLET_MULTI_MINT_E5 = newMAX_PER_WALLET_MULTI_MINT_E5;
    MAX_PER_WALLET_MULTI_MINT_E6 = newMAX_PER_WALLET_MULTI_MINT_E6;
    MAX_PER_WALLET_MULTI_MINT_E7 = newMAX_PER_WALLET_MULTI_MINT_E7;
    MAX_PER_WALLET_MULTI_MINT_E8 = newMAX_PER_WALLET_MULTI_MINT_E8;
    MAX_PER_WALLET_MULTI_MINT_E9 = newMAX_PER_WALLET_MULTI_MINT_E9;
    MAX_PER_WALLET_MULTI_MINT_E10 = newMAX_PER_WALLET_MULTI_MINT_E10;
    MAX_PER_WALLET_MULTI_MINT_SHARED =newMAX_PER_WALLET_MULTI_MINT_SHARED;
   }

   //sets max per wallet range mints
  function setMAX_PER_WALLET_RANGE_MINTS(uint newMAX_PER_WALLET_RANGE_MINT, uint newMAX_PER_WALLET_RANGE_GATED_MINT) public onlyOwner {
   MAX_PER_WALLET_RANGE_MINT = newMAX_PER_WALLET_RANGE_MINT;
   MAX_PER_WALLET_RANGE_GATED_MINT = newMAX_PER_WALLET_RANGE_GATED_MINT;
  }
  


//sets the merkles for gated mints
  function setMerkles(bytes32 newMerkleRange, bytes32 newMerkle1, bytes32 newMerkle2, bytes32 newMerkle3, bytes32 newMerkle4, bytes32 newMerkle5, bytes32 newMerkle6, bytes32 newMerkle7, bytes32 newMerkle8, bytes32 newMerkle9, bytes32 newMerkle10 ) public onlyOwner {
    Merkle1 = newMerkle1;
    Merkle2 = newMerkle2;
    Merkle3 = newMerkle3;
    Merkle4 = newMerkle4;
    Merkle5 = newMerkle5;
    Merkle6 = newMerkle6;
    Merkle7 = newMerkle7;
    Merkle8 = newMerkle8;
    Merkle9 = newMerkle9;
    Merkle10 = newMerkle10;
    MerkleRange = newMerkleRange;
    }
    

     function setSALE_STATUS(uint newStateMultiSaleGated, uint newStateMultiSale, uint newStateRangeSale, uint newStateGatedRangeSale) public onlyOwner {
    require(newStateGatedRangeSale >= 0 && newStateGatedRangeSale <= 1, "no!");
     require(newStateRangeSale >= 0 && newStateRangeSale <= 1, "no!");
     require(newStateMultiSale >= 0 && newStateMultiSale <= 1, "no!");
      require(newStateMultiSaleGated >= 0 && newStateMultiSaleGated <= 1, "no!");
    SALE_STATUS_GATED_RANGE_SALE = newStateGatedRangeSale;
    SALE_STATUS_MINT_RANGE_SALE = newStateRangeSale;
    SALE_STATUS_MINT_MULTI_SALE = newStateMultiSale;
    SALE_STATUS_MINT_MULTI_SALE_GATED = newStateMultiSaleGated;
 
  }


   function editFLEX_ALLOWED_PER_WALLET_RANGE_MINT(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    FLEX_ALLOWED_PER_WALLET_RANGE_MINT[_a[i]] = _amount[i];
    }
  }

  function editFLEX_ALLOWED_PER_WALLET_RANGE_GATED_MINT(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    FLEX_ALLOWED_PER_WALLET_RANGE_GATED_MINT[_a[i]] = _amount[i];
    }
  }

  function editFLEX_ALLOWED_PER_WALLET_MULTI_MINT_SHARED(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    FLEX_ALLOWED_PER_WALLET_MULTI_MINT_SHARED[_a[i]] = _amount[i];
    }
  }


  function editNumMinted_FLEX_RANGE(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    NumMinted_FLEX_RANGE[_a[i]] = _amount[i];
    }
  }

  function editNumMinted_FLEX_RANGE_GATED(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    NumMinted_FLEX_RANGE_GATED[_a[i]] = _amount[i];
    }
  }

  function editMultiNumMinted1(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    MultiNumMinted1[_a[i]] = _amount[i];
    }
  }

  function editMultiNumMinted2(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    MultiNumMinted2[_a[i]] = _amount[i];
    }
  }

  function editMultiNumMinted3(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    MultiNumMinted3[_a[i]] = _amount[i];
    }
  }

  function editMultiNumMinted4(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    MultiNumMinted4[_a[i]] = _amount[i];
    }
  }

  function editMultiNumMinted5(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    MultiNumMinted5[_a[i]] = _amount[i];
    }
  }

  function editMultiNumMinted6(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    MultiNumMinted6[_a[i]] = _amount[i];
    }
  }

  function editMultiNumMinted7(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    MultiNumMinted7[_a[i]] = _amount[i];
    }
  }

  function editMultiNumMinted8(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    MultiNumMinted8[_a[i]] = _amount[i];
    }
  }

  function editMultiNumMinted9(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    MultiNumMinted9[_a[i]] = _amount[i];
    }
  }

  function editMultiNumMinted10(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    MultiNumMinted10[_a[i]] = _amount[i];
    }
  }


  function editMultiNumMinted_SHARED(address[] memory _a, uint256[] memory _amount) public onlyOwner {
    for(uint256 i; i < _a.length; i++){
    MultiNumMinted_SHARED[_a[i]] = _amount[i];
    }
  }

  function burnTokenfor(uint256 typeId, address burnTokenAddress)
        external
    {
        require(msg.sender == BurnerContract, "Invalid burner address");
        _burn(burnTokenAddress, typeId, 1);
    }

  function burnTokenfor_2Slot(uint256 typeId, address burnTokenAddress)
        external
    {
        require(msg.sender == BurnerContract2, "Invalid burner address");
        _burn(burnTokenAddress, typeId, 1);
    }

  function burnTokenfor_3Slot(uint256 typeId, address burnTokenAddress)
        external
    {
        require(msg.sender == BurnerContract3, "Invalid burner address");
        _burn(burnTokenAddress, typeId, 1);
    }

  function burnTokenfor_4Slot(uint256 typeId, address burnTokenAddress)
        external
    {
        require(msg.sender == BurnerContract4, "Invalid burner address");
        _burn(burnTokenAddress, typeId, 1);
    }

  function burnTokenfor_5Slot(uint256 typeId, address burnTokenAddress)
        external
    {
        require(msg.sender == BurnerContract5, "Invalid burner address");
        _burn(burnTokenAddress, typeId, 1);
    }



    function SetBurnerContractAddress(address BurnerContractAddress, address BurnerContractAddress2, address BurnerContractAddress3, address BurnerContractAddress4, address BurnerContractAddress5)
        external
        onlyOwner
    {
        BurnerContract = BurnerContractAddress;
        BurnerContract2 = BurnerContractAddress2;
        BurnerContract3 = BurnerContractAddress3;
        BurnerContract4 = BurnerContractAddress4;
        BurnerContract5 = BurnerContractAddress5;
    }

    function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) {
        super.setApprovalForAll(operator, approved);
    }

    function safeTransferFrom(address from, address to, uint256 tokenId, uint256 amount, bytes memory data)
        public
        override
        onlyAllowedOperator(from)
    {
        super.safeTransferFrom(from, to, tokenId, amount, data);
    }

    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) public virtual override onlyAllowedOperator(from) {
        super.safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    


  function contractURI() public view returns (string memory) {
    return _contractUri;
  }
}