APE Price: $1.08 (-7.79%)

Contract

0x606e9f439f0294B6443F6e250AaA60DAAbC7D371

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Creator1155Impl

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 55 : Creator1155Impl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { ERC1155Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import { IERC1155MetadataURIUpgradeable } from
    "@openzeppelin/contracts-upgradeable/interfaces/IERC1155MetadataURIUpgradeable.sol";
import { IERC165Upgradeable } from "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol";
import { ICreator1155 } from "../interfaces/ICreator1155.sol";
import { ICreator1155Initializer } from "../interfaces/ICreator1155Initializer.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import { MathUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol";

import { ContractVersionBase } from "../version/ContractVersionBase.sol";
import { CreatorPermissionControl } from "../permissions/CreatorPermissionControl.sol";
import { CreatorRendererControl } from "../renderer/CreatorRendererControl.sol";
import { CreatorRoyaltiesControl } from "../royalties/CreatorRoyaltiesControl.sol";
import { ICreatorCommands } from "../interfaces/ICreatorCommands.sol";
import { IMinter1155 } from "../interfaces/IMinter1155.sol";
import { IRenderer1155 } from "../interfaces/IRenderer1155.sol";
import { ITransferHookReceiver } from "../interfaces/ITransferHookReceiver.sol";
import { IFactoryManagedUpgradeGate } from "../interfaces/IFactoryManagedUpgradeGate.sol";
import { ICreator1155 } from "../interfaces/ICreator1155.sol";
import { LegacyNamingControl } from "../legacy-naming/LegacyNamingControl.sol";
import { PublicMulticall } from "../utils/PublicMulticall.sol";
import { SharedBaseConstants } from "../shared/SharedBaseConstants.sol";
import { TransferHelperUtils } from "../utils/TransferHelperUtils.sol";
import { Creator1155StorageV1 } from "./Creator1155StorageV1.sol";
import { ERC1155RewardsStorageV1 } from "../rewards/abstract/ERC1155RewardsStorageV1.sol";
import { RewardSplits, RewardSplitsLib } from "../rewards/abstract/RewardSplits.sol";
import {IArbInfo} from "../interfaces/IArbInfo.sol";

/// @title Creator1155Impl
/// @notice The core implementation contract for a creator's 1155 token
contract Creator1155Impl is
    ICreator1155,
    ICreator1155Initializer,
    ContractVersionBase,
    ReentrancyGuardUpgradeable,
    PublicMulticall,
    ERC1155Upgradeable,
    UUPSUpgradeable,
    CreatorRendererControl,
    LegacyNamingControl,
    Creator1155StorageV1,
    CreatorPermissionControl,
    CreatorRoyaltiesControl,
    RewardSplits,
    ERC1155RewardsStorageV1
{
    /// @notice This user role allows for any action to be performed
    uint256 public constant PERMISSION_BIT_ADMIN = 2 ** 1;
    /// @notice This user role allows for only mint actions to be performed
    uint256 public constant PERMISSION_BIT_MINTER = 2 ** 2;

    /// @notice This user role allows for only managing sales configurations
    uint256 public constant PERMISSION_BIT_SALES = 2 ** 3;
    /// @notice This user role allows for only managing metadata configuration
    uint256 public constant PERMISSION_BIT_METADATA = 2 ** 4;
    /// @notice This user role allows for only withdrawing funds and setting funds withdraw address
    uint256 public constant PERMISSION_BIT_FUNDS_MANAGER = 2 ** 5;
    /// @notice Factory contract
    IFactoryManagedUpgradeGate internal immutable factory;

    uint256 public immutable MINT_FEE;

    constructor(
        uint256 _mintFeeAmount,
        address _mintFeeRecipient,
        address _factory,
        address _protocolRewards
    ) RewardSplits(_protocolRewards, _mintFeeRecipient)
        initializer
    {
        MINT_FEE = _mintFeeAmount;
        factory = IFactoryManagedUpgradeGate(_factory);
    }

    /// @notice Initializes the contract
    /// @param contractName the legacy on-chain contract name
    /// @param newContractURI The contract URI
    /// @param defaultRoyaltyConfiguration The default royalty configuration
    /// @param defaultAdmin The default admin to manage the token
    /// @param setupActions The setup actions to run, if any
    function initialize(
        string memory contractName,
        string memory newContractURI,
        RoyaltyConfiguration memory defaultRoyaltyConfiguration,
        address payable defaultAdmin,
        bytes[] calldata setupActions
    )
        external
        nonReentrant
        initializer
    {
        // We are not initalizing the OZ 1155 implementation
        // to save contract storage space and runtime
        // since the only thing affected here is the uri.
        // __ERC1155_init("");

        // Setup uups
        __UUPSUpgradeable_init();

        // Setup re-entracy guard
        __ReentrancyGuard_init();

        // Setup contract-default token ID
        _setupDefaultToken(defaultAdmin, newContractURI, defaultRoyaltyConfiguration);

        // Set owner to default admin
        _setOwner(defaultAdmin);

        _setFundsRecipient(defaultAdmin);

        _setName(contractName);

        // Run Setup actions
        if (setupActions.length > 0) {
            // Temporarily make sender admin
            _addPermission(CONTRACT_BASE_ID, msg.sender, PERMISSION_BIT_ADMIN);

            // Make calls
            multicall(setupActions);

            // Remove admin
            _removePermission(CONTRACT_BASE_ID, msg.sender, PERMISSION_BIT_ADMIN);
        }

        IArbInfo(0x0000000000000000000000000000000000000065).configureAutomaticYield();

    }

    /// @notice sets up the global configuration for the 1155 contract
    /// @param newContractURI The contract URI
    /// @param defaultRoyaltyConfiguration The default royalty configuration
    function _setupDefaultToken(
        address defaultAdmin,
        string memory newContractURI,
        RoyaltyConfiguration memory defaultRoyaltyConfiguration
    )
        internal
    {
        // Add admin permission to default admin to manage contract
        _addPermission(CONTRACT_BASE_ID, defaultAdmin, PERMISSION_BIT_ADMIN);

        // Mint token ID 0 / don't allow any user mints
        _setupNewToken(newContractURI, 0, false);

        // Update default royalties
        _updateRoyalties(CONTRACT_BASE_ID, defaultRoyaltyConfiguration);
    }

    /// @notice Updates the royalty configuration for a token
    /// @param tokenId The token ID to update
    /// @param newConfiguration The new royalty configuration
    function updateRoyaltiesForToken(
        uint256 tokenId,
        RoyaltyConfiguration memory newConfiguration
    )
        external
        onlyAdminOrRole(tokenId, PERMISSION_BIT_FUNDS_MANAGER)
    {
        _updateRoyalties(tokenId, newConfiguration);
    }

    /// @notice remove this function from openzeppelin impl
    /// @dev This makes this internal function a no-op
    function _setURI(string memory newuri) internal virtual override { }

    /// @notice This gets the next token in line to be minted when minting linearly (default behavior) and updates the
    /// counter
    function _getAndUpdateNextTokenId() internal returns (uint256) {
        unchecked {
            return nextTokenId++;
        }
    }

    /// @notice Ensure that the next token ID is correct
    /// @dev This reverts if the invariant doesn't match. This is used for multicall token id assumptions
    /// @param lastTokenId The last token ID
    function assumeLastTokenIdMatches(uint256 lastTokenId) external view {
        unchecked {
            if (nextTokenId - 1 != lastTokenId) {
                revert TokenIdMismatch(lastTokenId, nextTokenId - 1);
            }
        }
    }

    /// @notice Checks if a user either has a role for a token or if they are the admin
    /// @dev This is an internal function that is called by the external getter and internal functions
    /// @param user The user to check
    /// @param tokenId The token ID to check
    /// @param role The role to check
    /// @return true or false if the permission exists for the user given the token id
    function _isAdminOrRole(address user, uint256 tokenId, uint256 role) internal view returns (bool) {
        return _hasAnyPermission(tokenId, user, PERMISSION_BIT_ADMIN | role);
    }

    /// @notice Checks if a user either has a role for a token or if they are the admin
    /// @param user The user to check
    /// @param tokenId The token ID to check
    /// @param role The role to check
    /// @return true or false if the permission exists for the user given the token id
    function isAdminOrRole(address user, uint256 tokenId, uint256 role) external view returns (bool) {
        return _isAdminOrRole(user, tokenId, role);
    }

    /// @notice Checks if the user is an admin for the given tokenId
    /// @dev This function reverts if the permission does not exist for the given user and tokenId
    /// @param user user to check
    /// @param tokenId tokenId to check
    /// @param role role to check for admin
    function _requireAdminOrRole(address user, uint256 tokenId, uint256 role) internal view {
        if (
            !(
                _hasAnyPermission(tokenId, user, PERMISSION_BIT_ADMIN | role)
                    || _hasAnyPermission(CONTRACT_BASE_ID, user, PERMISSION_BIT_ADMIN | role)
            )
        ) {
            revert UserMissingRoleForToken(user, tokenId, role);
        }
    }

    /// @notice Checks if the user is an admin
    /// @dev This reverts if the user is not an admin for the given token id or contract
    /// @param user user to check
    /// @param tokenId tokenId to check
    function _requireAdmin(address user, uint256 tokenId) internal view {
        if (
            !(
                _hasAnyPermission(tokenId, user, PERMISSION_BIT_ADMIN)
                    || _hasAnyPermission(CONTRACT_BASE_ID, user, PERMISSION_BIT_ADMIN)
            )
        ) {
            revert UserMissingRoleForToken(user, tokenId, PERMISSION_BIT_ADMIN);
        }
    }

    /// @notice Modifier checking if the user is an admin or has a role
    /// @dev This reverts if the msg.sender is not an admin for the given token id or contract
    /// @param tokenId tokenId to check
    /// @param role role to check
    modifier onlyAdminOrRole(uint256 tokenId, uint256 role) {
        _requireAdminOrRole(msg.sender, tokenId, role);
        _;
    }

    /// @notice Modifier checking if the user is an admin
    /// @dev This reverts if the msg.sender is not an admin for the given token id or contract
    /// @param tokenId tokenId to check
    modifier onlyAdmin(uint256 tokenId) {
        _requireAdmin(msg.sender, tokenId);
        _;
    }

    /// @notice Modifier checking if the requested quantity of tokens can be minted for the tokenId
    /// @dev This reverts if the number that can be minted is exceeded
    /// @param tokenId token id to check available allowed quantity
    /// @param quantity requested to be minted
    modifier canMintQuantity(uint256 tokenId, uint256 quantity) {
        _requireCanMintQuantity(tokenId, quantity);
        _;
    }

    /// @notice Only from approved address for burn
    /// @param from address that the tokens will be burned from, validate that this is msg.sender or that msg.sender is
    /// approved
    modifier onlyFromApprovedForBurn(address from) {
        if (from != msg.sender && !isApprovedForAll(from, msg.sender)) {
            revert Burn_NotOwnerOrApproved(msg.sender, from);
        }

        _;
    }

    /// @notice Checks if a user can mint a quantity of a token
    /// @dev Reverts if the mint exceeds the allowed quantity (or if the token does not exist)
    /// @param tokenId The token ID to check
    /// @param quantity The quantity of tokens to mint to check
    function _requireCanMintQuantity(uint256 tokenId, uint256 quantity) internal view {
        TokenData storage tokenInformation = tokens[tokenId];
        if (tokenInformation.totalMinted + quantity > tokenInformation.maxSupply) {
            revert CannotMintMoreTokens(tokenId, quantity, tokenInformation.totalMinted, tokenInformation.maxSupply);
        }
    }

    /// @notice Set up a new token
    /// @param newURI The URI for the token
    /// @param maxSupply The maximum supply of the token
    /// @param isSoulbound Whether the token is soulbound
    function setupNewToken(
        string calldata newURI,
        uint256 maxSupply,
        bool isSoulbound
    )
        public
        onlyAdminOrRole(CONTRACT_BASE_ID, PERMISSION_BIT_MINTER)
        nonReentrant
        returns (uint256)
    {
        uint256 tokenId = _setupNewTokenAndPermission(newURI, maxSupply, msg.sender, PERMISSION_BIT_ADMIN, isSoulbound);

        return tokenId;
    }

    /// @notice Set up a new token with a create referral
    /// @param newURI The URI for the token
    /// @param maxSupply The maximum supply of the token
    /// @param createReferral The address of the create referral
    /// @param isSoulbound Whether the token is soulbound
    function setupNewTokenWithCreateReferral(
        string calldata newURI,
        uint256 maxSupply,
        address createReferral,
        bool isSoulbound  
    ) public onlyAdminOrRole(CONTRACT_BASE_ID, PERMISSION_BIT_MINTER) nonReentrant returns (uint256) {
        uint256 tokenId = _setupNewTokenAndPermission(newURI, maxSupply, msg.sender, PERMISSION_BIT_ADMIN, isSoulbound);

        _setCreateReferral(tokenId, createReferral);

        return tokenId;
    }

    function _setupNewTokenAndPermission(string memory newURI, uint256 maxSupply, address user, uint256 permission, bool isSoulbound) internal returns (uint256) {
        uint256 tokenId = _setupNewToken(newURI, maxSupply, isSoulbound);

        _addPermission(tokenId, user, permission);

        if (bytes(newURI).length > 0) {
            emit URI(newURI, tokenId);
        }

        emit SetupNewToken(tokenId, user, newURI, maxSupply);

        return tokenId;
    }

    /// @notice Update the token URI for a token
    /// @param tokenId The token ID to update the URI for
    /// @param _newURI The new URI
    function updateTokenURI(
        uint256 tokenId,
        string memory _newURI
    )
        external
        onlyAdminOrRole(tokenId, PERMISSION_BIT_METADATA)
    {
        if (tokenId == CONTRACT_BASE_ID) {
            revert();
        }
        emit URI(_newURI, tokenId);
        tokens[tokenId].uri = _newURI;
    }

    /// @notice Update the global contract metadata
    /// @param _newURI The new contract URI
    /// @param _newName The new contract name
    function updateContractMetadata(
        string memory _newURI,
        string memory _newName
    )
        external
        onlyAdminOrRole(0, PERMISSION_BIT_METADATA)
    {
        tokens[CONTRACT_BASE_ID].uri = _newURI;
        _setName(_newName);
        emit ContractMetadataUpdated(msg.sender, _newURI, _newName);
    }

    function _setupNewToken(string memory newURI, uint256 maxSupply, bool isSoulbound) internal returns (uint256 tokenId) {
        tokenId = _getAndUpdateNextTokenId();
        TokenData memory tokenData = TokenData({ uri: newURI, maxSupply: maxSupply, totalMinted: 0, isSoulbound: isSoulbound });
        tokens[tokenId] = tokenData;
        emit UpdatedToken(msg.sender, tokenId, tokenData);
        emit SetupSoulbound(tokenId, isSoulbound);
    }

    /// @notice Add a role to a user for a token
    /// @param tokenId The token ID to add the role to
    /// @param user The user to add the role to
    /// @param permissionBits The permission bit to add
    function addPermission(uint256 tokenId, address user, uint256 permissionBits) external onlyAdmin(tokenId) {
        _addPermission(tokenId, user, permissionBits);
    }

    /// @notice Remove a role from a user for a token
    /// @param tokenId The token ID to remove the role from
    /// @param user The user to remove the role from
    /// @param permissionBits The permission bit to remove
    function removePermission(uint256 tokenId, address user, uint256 permissionBits) external {
        address sender = msg.sender;

        // Check if the user is an admin if they do not have the roles they are attempting to remove.
        if (!(user == sender && _hasAllPermissions(tokenId, sender, permissionBits))) {
            // Ensure that the sender of this message is an admin
            _requireAdmin(sender, tokenId);
        }

        _removePermission(tokenId, user, permissionBits);

        // Clear owner field on contract if removed permission is owner.
        if (tokenId == CONTRACT_BASE_ID && user == config.owner && !_hasAnyPermission(CONTRACT_BASE_ID, user, PERMISSION_BIT_ADMIN)) {
            _setOwner(address(0));
        }
    }

    /// @notice Set the owner of the contract
    /// @param newOwner The new owner of the contract
    function setOwner(address newOwner) external onlyAdmin(CONTRACT_BASE_ID) {
        if (!_hasAnyPermission(CONTRACT_BASE_ID, newOwner, PERMISSION_BIT_ADMIN)) {
            revert NewOwnerNeedsToBeAdmin();
        }

        // Update owner field
        _setOwner(newOwner);
    }

    /// @notice Getter for the owner singleton of the contract for outside interfaces
    /// @return the owner of the contract singleton for compat.
    function owner() external view returns (address) {
        return config.owner;
    }

    /// @notice AdminMint that only checks if the requested quantity can be minted and has a re-entrant guard
    /// @param recipient recipient for admin minted tokens
    /// @param tokenId token id to mint
    /// @param quantity quantity to mint
    /// @param data callback data as specified by the 1155 spec
    function _adminMint(address recipient, uint256 tokenId, uint256 quantity, bytes memory data) internal {
        _mint(recipient, tokenId, quantity, data);
    }

    /// @notice Mint a token to a user as the admin or minter
    /// @param recipient The recipient of the token
    /// @param tokenId The token ID to mint
    /// @param quantity The quantity of tokens to mint
    /// @param data The data to pass to the onERC1155Received function
    function adminMint(
        address recipient,
        uint256 tokenId,
        uint256 quantity,
        bytes memory data
    )
        external
        nonReentrant
        onlyAdminOrRole(tokenId, PERMISSION_BIT_MINTER)
    {
        // Call internal admin mint
        _adminMint(recipient, tokenId, quantity, data);
        emit AdminMinted(msg.sender, recipient, tokenId, quantity);
    }

    /// @notice Batch mint tokens to a user as the admin or minter
    /// @param recipient The recipient of the tokens
    /// @param tokenIds The token IDs to mint
    /// @param quantities The quantities of tokens to mint
    /// @param data The data to pass to the onERC1155BatchReceived function
    function adminMintBatch(
        address recipient,
        uint256[] memory tokenIds,
        uint256[] memory quantities,
        bytes memory data
    )
        external
        nonReentrant
    {
        bool isGlobalAdminOrMinter = _isAdminOrRole(msg.sender, CONTRACT_BASE_ID, PERMISSION_BIT_MINTER);

        for (uint256 i = 0; i < tokenIds.length; ++i) {
            if (!isGlobalAdminOrMinter) {
                _requireAdminOrRole(msg.sender, tokenIds[i], PERMISSION_BIT_MINTER);
            }
        }
        _mintBatch(recipient, tokenIds, quantities, data);
        emit AdminMintedBatch(msg.sender, recipient, tokenIds, quantities);
    }

    /// @notice Mint tokens given a minter contract and minter arguments
    /// @param minter The minter contract to use
    /// @param tokenId The token ID to mint
    /// @param quantity The quantity of tokens to mint
    /// @param minterArguments The arguments to pass to the minter
    function mint(
        IMinter1155 minter,
        uint256 tokenId,
        uint256 quantity,
        bytes calldata minterArguments
    )
        external
        payable
        nonReentrant
    {
        _mint(minter, tokenId, quantity, new address[](0), minterArguments);
    }

    /// @notice Mint tokens and payout rewards given a minter contract, minter arguments, and rewards arguments
    /// @param minter The minter contract to use
    /// @param tokenId The token ID to mint
    /// @param quantity The quantity of tokens to mint
    /// @param rewardsRecipients The addresses of rewards arguments - rewardsRecipients[0] = mintReferral, rewardsRecipients[1] = platformReferral
    /// @param minterArguments The arguments to pass to the minter
    function mintWithRewards(
        IMinter1155 minter,
        uint256 tokenId,
        uint256 quantity,
        address[] calldata rewardsRecipients,
        bytes calldata minterArguments
    ) external payable nonReentrant {
        _mint(minter, tokenId, quantity, rewardsRecipients, minterArguments);
    }

    function _mintAndHandleRewards(
        IMinter1155 minter,
        address[] memory rewardsRecipients,
        uint256 valueSent,
        uint256 totalReward,
        uint256 tokenId,
        uint256 quantity,
        bytes calldata minterArguments
    ) private {
        uint256 ethValueSent = _handleRewardsAndGetValueRemaining(valueSent, totalReward, tokenId, rewardsRecipients);

        _executeCommands(minter.requestMint(msg.sender, tokenId, quantity, ethValueSent, minterArguments).commands, ethValueSent, tokenId);
        emit Purchased(msg.sender, address(minter), tokenId, quantity, valueSent);
    }

    function _handleRewardsAndGetValueRemaining(
        uint256 totalSentValue,
        uint256 totalReward,
        uint256 tokenId,
        address[] memory rewardsRecipients
    ) internal returns (uint256 valueRemaining) {
        // 1. Get rewards recipients

        // create referral is pulled from storage, if it's not set, defaults to freee reward recipient
        address createReferral = createReferrals[tokenId];
        if (createReferral == address(0)) {
            createReferral = rewardRecipient;
        }

        // mint referral is passed in arguments to minting functions; if it's not set, defaults to freee reward recipient
        address mintReferral = rewardsRecipients.length > 0 ? rewardsRecipients[0] : rewardRecipient;
        if (mintReferral == address(0)) {
            mintReferral = rewardRecipient;
        }

        // creator reward recipient is pulled from storage, if it's not set, defaults to freee reward recipient
        address creatorRewardRecipient = getCreatorRewardRecipient(tokenId);
        if (creatorRewardRecipient == address(0)) {
            creatorRewardRecipient = rewardRecipient;
        }

        // first minter is pulled from storage, if it's not set, defaults to creator reward recipient (which is freee if there is no creator reward recipient set)
        address firstMinter = firstMinters[tokenId];
        if (firstMinter == address(0)) {
            firstMinter = creatorRewardRecipient;
        }

        // 2. Get rewards amounts - which varies if its a paid or free mint

        RewardsSettings memory settings;
        if (totalSentValue < totalReward) {
            revert INVALID_ETH_AMOUNT();
            // if value sent is the same as the reward amount, we assume its a free mint
        } else if (totalSentValue == totalReward) {
            settings = RewardSplitsLib.getRewards(false, totalReward);
            // otherwise, we assume its a paid mint
        } else {
            settings = RewardSplitsLib.getRewards(true, totalReward);

            unchecked {
                valueRemaining = totalSentValue - totalReward;
            }
        }

        // 3. Deposit rewards rewards

        protocolRewards.depositRewards{value: totalReward}(
            // if there was no creator reward amount, 0 out that address
            settings.creatorReward == 0 ? address(0) : creatorRewardRecipient,
            settings.creatorReward,
            createReferral,
            settings.createReferralReward,
            mintReferral,
            settings.mintReferralReward,
            firstMinter,
            settings.firstMinterReward,
            rewardRecipient,
            settings.freeeReward
        );
    }

    function _mint(IMinter1155 minter, uint256 tokenId, uint256 quantity, address[] memory rewardsRecipients, bytes calldata minterArguments) private {
        // Require admin from the minter to mint
        _requireAdminOrRole(address(minter), tokenId, PERMISSION_BIT_MINTER);

        uint256 totalReward = MINT_FEE * quantity;

        _mintAndHandleRewards(minter, rewardsRecipients, msg.value, totalReward, tokenId, quantity, minterArguments);
    }

    function mintFee() external view returns (uint256) {
        return MINT_FEE;
    }

    /// @notice Get the creator reward recipient address for a specific token.
    /// @param tokenId The token id to get the creator reward recipient for
    /// @dev Returns the royalty recipient address for the token if set; otherwise uses the fundsRecipient.
    /// If both are not set, this contract will be set as the recipient, and an account with
    /// `PERMISSION_BIT_FUNDS_MANAGER` will be able to withdraw via the `withdrawFor` function.
    function getCreatorRewardRecipient(uint256 tokenId) public view returns (address) {
        address royaltyRecipient = getRoyalties(tokenId).royaltyRecipient;

        if (royaltyRecipient != address(0)) {
            return royaltyRecipient;
        }

        if (config.fundsRecipient != address(0)) {
            return config.fundsRecipient;
        }

        return address(this);
    }

    /// @notice Set a metadata renderer for a token
    /// @param tokenId The token ID to set the renderer for
    /// @param renderer The renderer to set
    function setTokenMetadataRenderer(
        uint256 tokenId,
        IRenderer1155 renderer
    )
        external
        nonReentrant
        onlyAdminOrRole(tokenId, PERMISSION_BIT_METADATA)
    {
        _setRenderer(tokenId, renderer);

        if (tokenId == 0) {
            emit ContractRendererUpdated(renderer);
        } else {
            // We don't know the uri from the renderer but can emit a notification to the indexer here
            emit URI("", tokenId);
        }
    }

    /// Execute Minter Commands ///

    /// @notice Internal functions to execute commands returned by the minter
    /// @param commands list of command structs
    /// @param ethValueSent the ethereum value sent in the mint transaction into the contract
    /// @param tokenId the token id the user requested to mint (0 if the token id is set by the minter itself across the
    /// whole contract)
    function _executeCommands(
        ICreatorCommands.Command[] memory commands,
        uint256 ethValueSent,
        uint256 tokenId
    )
        internal
    {
        for (uint256 i = 0; i < commands.length; ++i) {
            ICreatorCommands.CreatorActions method = commands[i].method;
            if (method == ICreatorCommands.CreatorActions.SEND_ETH) {
                (address recipient, uint256 amount) = abi.decode(commands[i].args, (address, uint256));
                if (ethValueSent > amount) {
                    revert Mint_InsolventSaleTransfer();
                }
                if (
                    !TransferHelperUtils.safeSendETH(recipient, amount, TransferHelperUtils.FUNDS_SEND_NORMAL_GAS_LIMIT)
                ) {
                    revert Mint_ValueTransferFail();
                }
            } else if (method == ICreatorCommands.CreatorActions.MINT) {
                (address recipient, uint256 mintTokenId, uint256 quantity) =
                    abi.decode(commands[i].args, (address, uint256, uint256));
                if (tokenId != 0 && mintTokenId != tokenId) {
                    revert Mint_TokenIDMintNotAllowed();
                }
                _mint(recipient, tokenId, quantity, "");
            } else {
                // no-op
            }
        }
    }

    /// @notice Token info getter
    /// @param tokenId token id to get info for
    /// @return TokenData struct returned
    function getTokenInfo(uint256 tokenId) external view returns (TokenData memory) {
        return tokens[tokenId];
    }

    /// @notice Proxy setter for sale contracts (only callable by SALES permission or admin)
    /// @param tokenId The token ID to call the sale contract with
    /// @param salesConfig The sales config contract to call
    /// @param data The data to pass to the sales config contract
    function callSale(
        uint256 tokenId,
        IMinter1155 salesConfig,
        bytes calldata data
    )
        external
        onlyAdminOrRole(tokenId, PERMISSION_BIT_SALES)
    {
        _requireAdminOrRole(address(salesConfig), tokenId, PERMISSION_BIT_MINTER);
        if (!salesConfig.supportsInterface(type(IMinter1155).interfaceId)) {
            revert Sale_CannotCallNonSalesContract(address(salesConfig));
        }

        // Get the token id encoded in the calldata for the sales config
        // Assume that it is the first 32 bytes following the function selector
        uint256 encodedTokenId = uint256(bytes32(data[4:36]));

        // Ensure the encoded token id matches the passed token id
        if (encodedTokenId != tokenId) {
            revert Call_TokenIdMismatch();
        }

        (bool success, bytes memory why) = address(salesConfig).call(data);
        if (!success) {
            revert CallFailed(why);
        }
    }

    /// @notice Proxy setter for renderer contracts (only callable by METADATA permission or admin)
    /// @param tokenId The token ID to call the renderer contract with
    /// @param data The data to pass to the renderer contract
    function callRenderer(
        uint256 tokenId,
        bytes memory data
    )
        external
        onlyAdminOrRole(tokenId, PERMISSION_BIT_METADATA)
    {
        // We assume any renderers set are checked for EIP165 signature during write stage.
        (bool success, bytes memory why) = address(getCustomRenderer(tokenId)).call(data);
        if (!success) {
            revert CallFailed(why);
        }
    }

    /// @notice Returns true if the contract implements the interface defined by interfaceId
    /// @param interfaceId The interface to check for
    /// @return if the interfaceId is marked as supported
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(CreatorRoyaltiesControl, ERC1155Upgradeable, IERC165Upgradeable)
        returns (bool)
    {
        return super.supportsInterface(interfaceId) || interfaceId == type(ICreator1155).interfaceId
            || ERC1155Upgradeable.supportsInterface(interfaceId);
    }

    /// Generic 1155 function overrides ///

    /// @notice Mint function that 1) checks quantity and 2) handles supply royalty 3) keeps track of allowed tokens
    /// @param to to mint to
    /// @param id token id to mint
    /// @param amount of tokens to mint
    /// @param data as specified by 1155 standard
    function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual override {
        _requireCanMintQuantity(id, amount);

        tokens[id].totalMinted += amount;

        super._mint(to, id, amount, data);
    }

    /// @notice Mint batch function that 1) checks quantity and 2) handles supply royalty 3) keeps track of allowed
    /// tokens
    /// @param to to mint to
    /// @param ids token ids to mint
    /// @param amounts of tokens to mint
    /// @param data as specified by 1155 standard
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        internal
        virtual
        override
    {
        uint256 numTokens = ids.length;
        for (uint256 i = 0; i < numTokens; ++i) {
            _requireCanMintQuantity(ids[i], amounts[i]);
            tokens[ids[i]].totalMinted += amounts[i];
        }
        super._mintBatch(to, ids, amounts, data);
    }

    /// @notice Burns a batch of tokens
    /// @dev Only the current owner is allowed to burn
    /// @param from the user to burn from
    /// @param tokenIds The token ID to burn
    /// @param amounts The amount of tokens to burn
    function burnBatch(address from, uint256[] calldata tokenIds, uint256[] calldata amounts) external {
        if (from != msg.sender && !isApprovedForAll(from, msg.sender)) {
            revert Burn_NotOwnerOrApproved(msg.sender, from);
        }

        _burnBatch(from, tokenIds, amounts);
    }

    function setTransferHook(ITransferHookReceiver transferHook) external onlyAdmin(CONTRACT_BASE_ID) {
        if (address(transferHook) != address(0)) {
            if (!transferHook.supportsInterface(type(ITransferHookReceiver).interfaceId)) {
                revert Config_TransferHookNotSupported(address(transferHook));
            }
        }

        config.transferHook = transferHook;
        emit ConfigUpdated(msg.sender, ConfigUpdate.TRANSFER_HOOK, config);
    }

    /// @notice Hook before token transfer that checks for a transfer hook integration
    /// @param operator operator moving the tokens
    /// @param from from address
    /// @param to to address
    /// @param ids token ids to move
    /// @param amounts amounts of tokens
    /// @param data data of tokens
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        internal
        override
    {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
        if (address(config.transferHook) != address(0)) {
            config.transferHook.onTokenTransferBatch({
                target: address(this),
                operator: operator,
                from: from,
                to: to,
                ids: ids,
                amounts: amounts,
                data: data
            });
        }

        for (uint256 i = 0; i < ids.length; i++) {
            if (tokens[ids[i]].isSoulbound && from != address(0)) {
                revert Transfer_NotAllowed();
            }
        }
    }

    /// @notice Returns the URI for the contract
    function contractURI() external view returns (string memory) {
        IRenderer1155 customRenderer = getCustomRenderer(CONTRACT_BASE_ID);
        if (address(customRenderer) != address(0)) {
            return customRenderer.contractURI();
        }
        return uri(0);
    }

    /// @notice Returns the URI for a token
    /// @param tokenId The token ID to return the URI for
    function uri(uint256 tokenId)
        public
        view
        override(ERC1155Upgradeable, IERC1155MetadataURIUpgradeable)
        returns (string memory)
    {
        if (bytes(tokens[tokenId].uri).length > 0) {
            return tokens[tokenId].uri;
        }
        return _render(tokenId);
    }

    /// @notice Internal setter for contract admin with no access checks
    /// @param newOwner new owner address
    function _setOwner(address newOwner) internal {
        address lastOwner = config.owner;
        config.owner = newOwner;

        emit OwnershipTransferred(lastOwner, newOwner);
        emit ConfigUpdated(msg.sender, ConfigUpdate.OWNER, config);
    }

    /// @notice Set funds recipient address
    /// @param fundsRecipient new funds recipient address
    function setFundsRecipient(address payable fundsRecipient)
        external
        onlyAdminOrRole(CONTRACT_BASE_ID, PERMISSION_BIT_FUNDS_MANAGER)
    {
        _setFundsRecipient(fundsRecipient);
    }

    /// @notice Internal no-checks set funds recipient address
    /// @param fundsRecipient new funds recipient address
    function _setFundsRecipient(address payable fundsRecipient) internal {
        config.fundsRecipient = fundsRecipient;
        emit ConfigUpdated(msg.sender, ConfigUpdate.FUNDS_RECIPIENT, config);
    }

    /// @notice Allows the create referral to update the address that can claim their rewards
    function updateCreateReferral(uint256 tokenId, address recipient) external {
        if (msg.sender != createReferrals[tokenId]) revert ONLY_CREATE_REFERRAL();

        _setCreateReferral(tokenId, recipient);
    }

    function _setCreateReferral(uint256 tokenId, address recipient) internal {
        createReferrals[tokenId] = recipient;
    }

    /// @notice Withdraws all ETH from the contract to the funds recipient address
    function withdraw() public onlyAdminOrRole(CONTRACT_BASE_ID, PERMISSION_BIT_FUNDS_MANAGER) {
        uint256 contractValue = address(this).balance;
        if (
            !TransferHelperUtils.safeSendETH(
                config.fundsRecipient, contractValue, TransferHelperUtils.FUNDS_SEND_NORMAL_GAS_LIMIT
            )
        ) {
            revert ETHWithdrawFailed(config.fundsRecipient, contractValue);
        }
    }

    function setSoulbound(bool _isSoulbound, uint256 tokenId) external onlyAdminOrRole(tokenId, PERMISSION_BIT_ADMIN) {
        tokens[tokenId].isSoulbound = _isSoulbound;
        emit SetupSoulbound(tokenId, _isSoulbound);
    }

    receive() external payable {}

    ///                                                          ///
    ///                         MANAGER UPGRADE                  ///
    ///                                                          ///

    /// @notice Ensures the caller is authorized to upgrade the contract
    /// @dev This function is called in `upgradeTo` & `upgradeToAndCall`
    /// @param _newImpl The new implementation address
    function _authorizeUpgrade(address _newImpl) internal view override onlyAdmin(CONTRACT_BASE_ID) {
        if (!factory.isRegisteredUpgradePath(_getImplementation(), _newImpl)) {
            revert();
        }
    }

     /// @notice Returns the current implementation address
    function implementation() external view returns (address) {
        return _getImplementation();
    }
}

File 2 of 55 : ERC1155Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155Upgradeable.sol";
import "./IERC1155ReceiverUpgradeable.sol";
import "./extensions/IERC1155MetadataURIUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @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 ERC1155Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC1155Upgradeable, IERC1155MetadataURIUpgradeable {
    using AddressUpgradeable 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}.
     */
    function __ERC1155_init(string memory uri_) internal onlyInitializing {
        __ERC1155_init_unchained(uri_);
    }

    function __ERC1155_init_unchained(string memory uri_) internal onlyInitializing {
        _setURI(uri_);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
        return
            interfaceId == type(IERC1155Upgradeable).interfaceId ||
            interfaceId == type(IERC1155MetadataURIUpgradeable).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: address zero is not a valid owner");
        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 token owner or 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: caller is not token owner or 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();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, to, ids, amounts, 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);

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

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

        _afterTokenTransfer(operator, from, to, ids, amounts, data);

        _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();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * 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 _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);

        _afterTokenTransfer(operator, address(0), to, ids, amounts, data);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Emits a {TransferSingle} event.
     *
     * 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();
        uint256[] memory ids = _asSingletonArray(id);
        uint256[] memory amounts = _asSingletonArray(amount);

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

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

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Emits a {TransferBatch} event.
     *
     * 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);

        _afterTokenTransfer(operator, from, address(0), ids, amounts, "");
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        require(owner != operator, "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 `ids` and `amounts` 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 {}

    /**
     * @dev Hook that is called after 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 _afterTokenTransfer(
        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 IERC1155ReceiverUpgradeable(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
                if (response != IERC1155ReceiverUpgradeable.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 IERC1155ReceiverUpgradeable(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
                bytes4 response
            ) {
                if (response != IERC1155ReceiverUpgradeable.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;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[47] private __gap;
}

File 3 of 55 : IERC1155MetadataURIUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../token/ERC1155/extensions/IERC1155MetadataURIUpgradeable.sol";

File 4 of 55 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol)

pragma solidity ^0.8.0;

import "../utils/introspection/IERC165Upgradeable.sol";

File 5 of 55 : ICreator1155.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { IERC165Upgradeable } from "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol";
import { IERC1155MetadataURIUpgradeable } from
    "@openzeppelin/contracts-upgradeable/interfaces/IERC1155MetadataURIUpgradeable.sol";
import { ICreator1155TypesV1 } from "../nft/ICreator1155TypesV1.sol";
import { IRenderer1155 } from "../interfaces/IRenderer1155.sol";
import { IMinter1155 } from "../interfaces/IMinter1155.sol";
import { IOwnable } from "../interfaces/IOwnable.sol";
import { IVersionedContract } from "./IVersionedContract.sol";
import { ICreatorRoyaltiesControl } from "../interfaces/ICreatorRoyaltiesControl.sol";

/// @notice Main interface for the Creator1155 contract
interface ICreator1155 is ICreator1155TypesV1, IVersionedContract, IOwnable, IERC1155MetadataURIUpgradeable {
    function PERMISSION_BIT_ADMIN() external returns (uint256);

    function PERMISSION_BIT_MINTER() external returns (uint256);

    function PERMISSION_BIT_SALES() external returns (uint256);

    function PERMISSION_BIT_METADATA() external returns (uint256);

    /// @notice Used to label the configuration update type
    enum ConfigUpdate {
        OWNER,
        FUNDS_RECIPIENT,
        TRANSFER_HOOK
    }

    event ConfigUpdated(address indexed updater, ConfigUpdate indexed updateType, ContractConfig newConfig);

    event UpdatedToken(address indexed from, uint256 indexed tokenId, TokenData tokenData);
    event SetupNewToken(uint256 indexed tokenId, address indexed sender, string newURI, uint256 maxSupply);
    event SetupSoulbound(uint256 indexed tokenId, bool isSoulbound);

    function setOwner(address newOwner) external;

    event ContractRendererUpdated(IRenderer1155 renderer);
    event ContractMetadataUpdated(address indexed updater, string uri, string name);
    event Purchased(
        address indexed sender, address indexed minter, uint256 indexed tokenId, uint256 quantity, uint256 value
    );

    event AdminMinted(address indexed sender, address indexed recipient, uint256 indexed tokenId, uint256 quantity);
    event AdminMintedBatch(address indexed sender, address indexed minter, uint256[] tokenIds, uint256[] quantities);

    error TokenIdMismatch(uint256 expected, uint256 actual);
    error UserMissingRoleForToken(address user, uint256 tokenId, uint256 role);

    error Config_TransferHookNotSupported(address proposedAddress);

    error Mint_InsolventSaleTransfer();
    error Mint_ValueTransferFail();
    error Mint_TokenIDMintNotAllowed();
    error Mint_UnknownCommand();

    error Burn_NotOwnerOrApproved(address operator, address user);

    error NewOwnerNeedsToBeAdmin();

    error Sale_CannotCallNonSalesContract(address targetContract);

    error CallFailed(bytes reason);
    error Renderer_NotValidRendererContract();

    error ETHWithdrawFailed(address recipient, uint256 amount);
    error FundsWithdrawInsolvent(uint256 amount, uint256 contractValue);

    error CannotMintMoreTokens(uint256 tokenId, uint256 quantity, uint256 totalMinted, uint256 maxSupply);

    error Call_TokenIdMismatch();

    error Transfer_NotAllowed();

    /// @notice Only allow minting one token id at time
    /// @dev Mint contract function that calls the underlying sales function for commands
    /// @param minter Address for the minter
    /// @param tokenId tokenId to mint, set to 0 for new tokenId
    /// @param quantity to mint
    /// @param minterArguments calldata for the minter contracts
    function mint(
        IMinter1155 minter,
        uint256 tokenId,
        uint256 quantity,
        bytes calldata minterArguments
    )
        external
        payable;

    function adminMint(address recipient, uint256 tokenId, uint256 quantity, bytes memory data) external;

    function adminMintBatch(
        address recipient,
        uint256[] memory tokenIds,
        uint256[] memory quantities,
        bytes memory data
    )
        external;

    function burnBatch(address user, uint256[] calldata tokenIds, uint256[] calldata amounts) external;

    /// @notice Contract call to setupNewToken
    /// @param tokenURI URI for the token
    /// @param maxSupply maxSupply for the token, set to 0 for open edition
    /// @param isSoulbound Whether the token is soulbound
    function setupNewToken(string memory tokenURI, uint256 maxSupply, bool isSoulbound) external returns (uint256 tokenId);

    function updateTokenURI(uint256 tokenId, string memory _newURI) external;

    function updateContractMetadata(string memory _newURI, string memory _newName) external;

    // Public interface for `setTokenMetadataRenderer(uint256, address) has been deprecated.

    function contractURI() external view returns (string memory);

    function assumeLastTokenIdMatches(uint256 tokenId) external;

    function updateRoyaltiesForToken(
        uint256 tokenId,
        ICreatorRoyaltiesControl.RoyaltyConfiguration memory royaltyConfiguration
    )
        external;

    function addPermission(uint256 tokenId, address user, uint256 permissionBits) external;

    function removePermission(uint256 tokenId, address user, uint256 permissionBits) external;

    function isAdminOrRole(address user, uint256 tokenId, uint256 role) external view returns (bool);

    function getTokenInfo(uint256 tokenId) external view returns (TokenData memory);

    function callRenderer(uint256 tokenId, bytes memory data) external;

    function callSale(uint256 tokenId, IMinter1155 salesConfig, bytes memory data) external;

    function mintFee() external view returns (uint256);

    /// @notice Withdraws all ETH from the contract to the funds recipient address
    function withdraw() external;

    /// @notice Returns the current implementation address
    function implementation() external view returns (address);
}

File 6 of 55 : ICreator1155Initializer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { ICreatorRoyaltiesControl } from "../interfaces/ICreatorRoyaltiesControl.sol";

interface ICreator1155Initializer {
    function initialize(
        string memory contractName,
        string memory newContractURI,
        ICreatorRoyaltiesControl.RoyaltyConfiguration memory defaultRoyaltyConfiguration,
        address payable defaultAdmin,
        bytes[] calldata setupActions
    )
        external;
}

File 7 of 55 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 8 of 55 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.0;

import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../ERC1967/ERC1967UpgradeUpgradeable.sol";
import "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 *
 * _Available since v4.1._
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable {
    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

    function __UUPSUpgradeable_init_unchained() internal onlyInitializing {
    }
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
    address private immutable __self = address(this);

    /**
     * @dev Check that the execution is being performed through a delegatecall call and that the execution context is
     * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case
     * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
     * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
     * fail.
     */
    modifier onlyProxy() {
        require(address(this) != __self, "Function must be called through delegatecall");
        require(_getImplementation() == __self, "Function must be called through active proxy");
        _;
    }

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall");
        _;
    }

    /**
     * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the
     * implementation. It is used to validate the implementation's compatibility when performing an upgrade.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
     */
    function proxiableUUID() external view virtual override notDelegated returns (bytes32) {
        return _IMPLEMENTATION_SLOT;
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeTo(address newImplementation) public virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, new bytes(0), false);
    }

    /**
     * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
     * encoded in `data`.
     *
     * Calls {_authorizeUpgrade}.
     *
     * Emits an {Upgraded} event.
     *
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
        _authorizeUpgrade(newImplementation);
        _upgradeToAndCallUUPS(newImplementation, data, true);
    }

    /**
     * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
     * {upgradeTo} and {upgradeToAndCall}.
     *
     * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
     *
     * ```solidity
     * function _authorizeUpgrade(address) internal override onlyOwner {}
     * ```
     */
    function _authorizeUpgrade(address newImplementation) internal virtual;

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 9 of 55 : MathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library MathUpgradeable {
    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) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 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 256, 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 << 3) < value ? 1 : 0);
        }
    }
}

File 10 of 55 : ContractVersionBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { IVersionedContract } from "../interfaces/IVersionedContract.sol";

/// @title ContractVersionBase
/// @notice Base contract for versioning contracts
contract ContractVersionBase is IVersionedContract {
    /// @notice The version of the contract
    function contractVersion() external pure override returns (string memory) {
        return "2.0.1";
    }
}

File 11 of 55 : CreatorPermissionControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { CreatorPermissionStorageV1 } from "./CreatorPermissionStorageV1.sol";
import { ICreatorPermissionControl } from "../interfaces/ICreatorPermissionControl.sol";

contract CreatorPermissionControl is CreatorPermissionStorageV1, ICreatorPermissionControl {
    /// @notice Check if the user has the given permissions
    /// @dev if multiple permissions are passed in this checks for all the permissions requested
    /// @return true or false if all of the passed in permissions apply
    function _hasPermissions(uint256 tokenId, address user, uint256 permissionBits) internal view returns (bool) {
        // Does a bitwise and and checks if any of those permissions match
        return permissions[tokenId][user] & permissionBits == permissionBits;
    }

    /// @notice Check if the user has any of the given permissions
    /// @dev if multiple permissions are passed in this checks for any one of those permissions
    /// @return true or false if any of the passed in permissions apply
    function _hasAnyPermission(uint256 tokenId, address user, uint256 permissionBits) internal view returns (bool) {
        // Does a bitwise and and checks if any of those permissions match
        return permissions[tokenId][user] & permissionBits > 0;
    }

    /// @notice Check if the user has all of the given permissions
    /// @dev if multiple permissions are passed in this checks for any one of those permissions
    /// @return true or false if any of the passed in permissions apply
    function _hasAllPermissions(uint256 tokenId, address user, uint256 permissionBits) internal view returns (bool) {
        // Does a bitwise and and checks if all of those permissions match
        return permissions[tokenId][user] & permissionBits == permissionBits;
    }

    /// @return raw permission bits for the given user
    function getPermissions(uint256 tokenId, address user) external view returns (uint256) {
        return permissions[tokenId][user];
    }

    /// @notice addPermission – internal function to add a set of permission bits to a user
    /// @param tokenId token id to add the permission to (0 indicates contract-wide add)
    /// @param user user to update permissions for
    /// @param permissionBits bits to add permissions to
    function _addPermission(uint256 tokenId, address user, uint256 permissionBits) internal {
        uint256 tokenPermissions = permissions[tokenId][user];
        tokenPermissions |= permissionBits;
        permissions[tokenId][user] = tokenPermissions;
        emit UpdatedPermissions(tokenId, user, tokenPermissions);
    }

    /// @notice _clearPermission clear permissions for user
    /// @param tokenId token id to clear permission from (0 indicates contract-wide action)
    function _clearPermissions(uint256 tokenId, address user) internal {
        permissions[tokenId][user] = 0;
        emit UpdatedPermissions(tokenId, user, 0);
    }

    /// @notice _removePermission removes permissions for user
    /// @param tokenId token id to clear permission from (0 indicates contract-wide action)
    /// @param user user to manage permissions for
    /// @param permissionBits set of permission bits to remove
    function _removePermission(uint256 tokenId, address user, uint256 permissionBits) internal {
        uint256 tokenPermissions = permissions[tokenId][user];
        tokenPermissions &= ~permissionBits;
        permissions[tokenId][user] = tokenPermissions;
        emit UpdatedPermissions(tokenId, user, tokenPermissions);
    }
}

File 12 of 55 : CreatorRendererControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { CreatorRendererStorageV1 } from "./CreatorRendererStorageV1.sol";
import { IRenderer1155 } from "../interfaces/IRenderer1155.sol";
import { ITransferHookReceiver } from "../interfaces/ITransferHookReceiver.sol";
import { SharedBaseConstants } from "../shared/SharedBaseConstants.sol";

/// @title CreatorRendererControl
/// @notice Contract for managing the renderer of an 1155 contract
abstract contract CreatorRendererControl is CreatorRendererStorageV1, SharedBaseConstants {
    function _setRenderer(uint256 tokenId, IRenderer1155 renderer) internal {
        customRenderers[tokenId] = renderer;
        if (address(renderer) != address(0)) {
            if (!renderer.supportsInterface(type(IRenderer1155).interfaceId)) {
                revert RendererNotValid(address(renderer));
            }
        }

        emit RendererUpdated({ tokenId: tokenId, renderer: address(renderer), user: msg.sender });
    }

    /// @notice Return the renderer for a given token
    /// @dev Returns address 0 for no results
    /// @param tokenId The token to get the renderer for
    function getCustomRenderer(uint256 tokenId) public view returns (IRenderer1155 customRenderer) {
        customRenderer = customRenderers[tokenId];
        if (address(customRenderer) == address(0)) {
            customRenderer = customRenderers[CONTRACT_BASE_ID];
        }
    }

    /// @notice Function called to render when an empty tokenURI exists on the contract
    function _render(uint256 tokenId) internal view returns (string memory) {
        return getCustomRenderer(tokenId).uri(tokenId);
    }
}

File 13 of 55 : CreatorRoyaltiesControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { CreatorRoyaltiesStorageV1 } from "./CreatorRoyaltiesStorageV1.sol";
import { ICreatorRoyaltiesControl } from "../interfaces/ICreatorRoyaltiesControl.sol";
import { SharedBaseConstants } from "../shared/SharedBaseConstants.sol";
import { IERC2981 } from "@openzeppelin/contracts/interfaces/IERC2981.sol";

/// @title CreatorRoyaltiesControl
/// @notice Contract for managing the royalties of an 1155 contract
abstract contract CreatorRoyaltiesControl is CreatorRoyaltiesStorageV1, SharedBaseConstants {
    uint256 immutable ROYALTY_BPS_TO_PERCENT = 10_000;

    /// @notice The royalty information for a given token.
    /// @param tokenId The token ID to get the royalty information for.
    function getRoyalties(uint256 tokenId) public view returns (RoyaltyConfiguration memory) {
        if (royalties[tokenId].royaltyRecipient != address(0)) {
            return royalties[tokenId];
        }
        // Otherwise, return default.
        return royalties[CONTRACT_BASE_ID];
    }

    /// @notice Returns the royalty information for a given token.
    /// @param tokenId The token ID to get the royalty information for.
    /// @param salePrice The sale price of the NFT asset specified by tokenId
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    )
        public
        view
        returns (address receiver, uint256 royaltyAmount)
    {
        RoyaltyConfiguration memory config = getRoyalties(tokenId);
        royaltyAmount = (config.royaltyBPS * salePrice) / ROYALTY_BPS_TO_PERCENT;
        receiver = config.royaltyRecipient;
    }

    /// @notice Returns the supply royalty information for a given token.
    /// @param tokenId The token ID to get the royalty information for.
    /// @param mintAmount The amount of tokens being minted.
    /// @param totalSupply The total supply of the token,
    function supplyRoyaltyInfo(
        uint256 tokenId,
        uint256 totalSupply,
        uint256 mintAmount
    )
        public
        view
        returns (address receiver, uint256 royaltyAmount)
    {
        RoyaltyConfiguration memory config = getRoyalties(tokenId);
        if (config.royaltyMintSchedule == 0) {
            return (config.royaltyRecipient, 0);
        }
        uint256 totalRoyaltyMints =
            (mintAmount + (totalSupply % config.royaltyMintSchedule)) / (config.royaltyMintSchedule - 1);
        return (config.royaltyRecipient, totalRoyaltyMints);
    }

    function _updateRoyalties(uint256 tokenId, RoyaltyConfiguration memory configuration) internal {
        // If a nonzero royalty mint schedule is set:
        if (configuration.royaltyMintSchedule != 0) {
            // Set the value to zero
            configuration.royaltyMintSchedule = 0;
        }
        // Don't allow setting royalties to burn address
        if (configuration.royaltyRecipient == address(0) && configuration.royaltyBPS > 0) {
            revert InvalidMintSchedule();
        }
        royalties[tokenId] = configuration;

        emit UpdatedRoyalties(tokenId, msg.sender, configuration);
    }

    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC2981).interfaceId;
    }
}

File 14 of 55 : ICreatorCommands.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/// @notice Creator Commands used by minter modules passed back to the main modules
interface ICreatorCommands {
    /// @notice This enum is used to define supported creator action types.
    /// This can change in the future
    enum CreatorActions
    // No operation - also the default for mintings that may not return a command
    {
        NO_OP,
        // Send ether
        SEND_ETH,
        // Mint operation
        MINT
    }

    /// @notice This command is for
    struct Command {
        // Method for operation
        CreatorActions method;
        // Arguments used for this operation
        bytes args;
    }

    /// @notice This command set is returned from the minter back to the user
    struct CommandSet {
        Command[] commands;
        uint256 at;
    }
}

File 15 of 55 : IMinter1155.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { IERC165Upgradeable } from "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol";
import { ICreatorCommands } from "./ICreatorCommands.sol";

/// @notice Minter standard interface
/// @dev Minters need to confirm to the ERC165 selector of type(IMinter1155).interfaceId
interface IMinter1155 is IERC165Upgradeable {
    function requestMint(
        address sender,
        uint256 tokenId,
        uint256 quantity,
        uint256 ethValueSent,
        bytes calldata minterArguments
    )
        external
        returns (ICreatorCommands.CommandSet memory commands);
}

File 16 of 55 : IRenderer1155.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { IERC165Upgradeable } from "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol";

/// @dev IERC165 type required
interface IRenderer1155 is IERC165Upgradeable {
    /// @notice Called for assigned tokenId, or when token id is globally set to a renderer
    /// @dev contract target is assumed to be msg.sender
    /// @param tokenId token id to get uri for
    function uri(uint256 tokenId) external view returns (string memory);

    /// @notice Only called for tokenId == 0
    /// @dev contract target is assumed to be msg.sender
    function contractURI() external view returns (string memory);

    /// @notice Sets up renderer from contract
    /// @param initData data to setup renderer with
    /// @dev contract target is assumed to be msg.sender
    function setup(bytes memory initData) external;

    // IERC165 type required – set in base helper
}

File 17 of 55 : ITransferHookReceiver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { IERC165Upgradeable } from "@openzeppelin/contracts-upgradeable/interfaces/IERC165Upgradeable.sol";

interface ITransferHookReceiver is IERC165Upgradeable {
    /// @notice Token transfer batch callback
    /// @param target target contract for transfer
    /// @param operator operator address for transfer
    /// @param from user address for amount transferred
    /// @param to user address for amount transferred
    /// @param ids list of token ids transferred
    /// @param amounts list of values transferred
    /// @param data data as perscribed by 1155 standard
    function onTokenTransferBatch(
        address target,
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    )
        external;

    // IERC165 type required
}

File 18 of 55 : IFactoryManagedUpgradeGate.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/// @notice Factory Upgrade Gate Admin Factory Implementation – Allows specific contract upgrades as a safety measure
interface IFactoryManagedUpgradeGate {
    /// @notice If an implementation is registered by the Builder DAO as an optional upgrade
    /// @param baseImpl The base implementation address
    /// @param upgradeImpl The upgrade implementation address
    function isRegisteredUpgradePath(address baseImpl, address upgradeImpl) external view returns (bool);

    /// @notice Called by the Builder DAO to offer implementation upgrades for created DAOs
    /// @param baseImpls The base implementation addresses
    /// @param upgradeImpl The upgrade implementation address
    function registerUpgradePath(address[] memory baseImpls, address upgradeImpl) external;

    /// @notice Called by the Builder DAO to remove an upgrade
    /// @param baseImpl The base implementation address
    /// @param upgradeImpl The upgrade implementation address
    function removeUpgradePath(address baseImpl, address upgradeImpl) external;

    event UpgradeRegistered(address indexed baseImpl, address indexed upgradeImpl);
    event UpgradeRemoved(address indexed baseImpl, address indexed upgradeImpl);
}

File 19 of 55 : LegacyNamingControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { ILegacyNaming } from "../interfaces/ILegacyNaming.sol";
import { LegacyNamingStorageV1 } from "./LegacyNamingStorageV1.sol";

/// @title LegacyNamingControl
/// @notice Contract for managing the name and symbol of an 1155 contract in the legacy naming scheme
contract LegacyNamingControl is LegacyNamingStorageV1, ILegacyNaming {
    /// @notice The name of the contract
    function name() external view returns (string memory) {
        return _name;
    }

    /// @notice The token symbol of the contract
    function symbol() external pure returns (string memory) { }

    function _setName(string memory _newName) internal {
        _name = _newName;
    }
}

File 20 of 55 : PublicMulticall.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "@openzeppelin/contracts/utils/Address.sol";

/// @title PublicMulticall
/// @notice Contract for executing a batch of function calls on this contract
abstract contract PublicMulticall {
    /**
     * @notice Receives and executes a batch of function calls on this contract.
     */
    function multicall(bytes[] calldata data) public virtual returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = Address.functionDelegateCall(address(this), data[i]);
        }
    }
}

File 21 of 55 : SharedBaseConstants.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

contract SharedBaseConstants {
    uint256 public constant CONTRACT_BASE_ID = 0;
}

File 22 of 55 : TransferHelperUtils.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/// @title TransferHelperUtils
/// @notice Helper functions for sending ETH
library TransferHelperUtils {
    /// @dev Gas limit to send funds
    uint256 internal constant FUNDS_SEND_LOW_GAS_LIMIT = 110_000;

    // @dev Gas limit to send funds – usable for splits, can use with withdraws
    uint256 internal constant FUNDS_SEND_NORMAL_GAS_LIMIT = 310_000;

    /// @notice Sends ETH to a recipient, making conservative estimates to not run out of gas
    /// @param recipient The address to send ETH to
    /// @param value The amount of ETH to send
    function safeSendETH(address recipient, uint256 value, uint256 gasLimit) internal returns (bool success) {
        (success,) = recipient.call{ value: value, gas: gasLimit }("");
    }
}

File 23 of 55 : Creator1155StorageV1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

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

/// @notice Storage for 1155 contract
contract Creator1155StorageV1 is ICreator1155TypesV1 {
    /// @notice token data stored for each token
    mapping(uint256 => TokenData) internal tokens;

    /// @notice metadata renderer contract for each token
    mapping(uint256 => address) public metadataRendererContract;

    /// @notice next token id available when using a linear mint style (default for launch)
    uint256 public nextTokenId;

    /// @notice Global contract configuration
    ContractConfig public config;

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 24 of 55 : ERC1155RewardsStorageV1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

contract ERC1155RewardsStorageV1 {
    mapping(uint256 => address) public createReferrals;

    mapping(uint256 => address) public firstMinters;

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 25 of 55 : RewardSplits.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import {IProtocolRewards} from "../interfaces/IProtocolRewards.sol";
import {IRewardSplits} from "../interfaces/IRewardSplits.sol";

library RewardSplitsLib {
    uint256 internal constant BPS_TO_PERCENT = 10_0000000;
    uint256 internal constant TOTAL_REWARD_PER_MINT_PCT = 10_0000000;

    uint256 internal constant CREATOR_REWARD_PCT = 40_000000;
    uint256 internal constant FIRST_MINTER_REWARD_PCT = 0;

    uint256 internal constant CREATE_REFERRAL_FREE_MINT_REWARD_PCT = 10_000000;
    uint256 internal constant MINT_REFERRAL_FREE_MINT_REWARD_PCT = 20_000000;
    uint256 internal constant FREEE_FREE_MINT_REWARD_PCT = 30_000000;

    uint256 internal constant CREATE_REFERRAL_PAID_MINT_REWARD_PCT = 10_000000;
    uint256 internal constant MINT_REFERRAL_PAID_MINT_REWARD_PCT = 30_000000;
    uint256 internal constant FREEE_PAID_MINT_REWARD_PCT = 60_000000;

    function computeRewardsPct(uint256 totalReward, uint256 rewardPct) internal pure returns (uint256) {
        return (totalReward * rewardPct) / BPS_TO_PERCENT;
    }

    function getRewardsSettingsPct(bool paidMint) private pure returns (IRewardSplits.RewardsSettings memory rewardSettings) {
        rewardSettings.creatorReward = paidMint ? 0 : CREATOR_REWARD_PCT;
        rewardSettings.createReferralReward = paidMint ? CREATE_REFERRAL_PAID_MINT_REWARD_PCT : CREATE_REFERRAL_FREE_MINT_REWARD_PCT;
        rewardSettings.mintReferralReward = paidMint ? MINT_REFERRAL_PAID_MINT_REWARD_PCT : MINT_REFERRAL_FREE_MINT_REWARD_PCT;
        rewardSettings.firstMinterReward = FIRST_MINTER_REWARD_PCT;
        // do we need this? since its recalculated below?
        // rewardSettings.freeeReward = totalReward - (rewardSettings.creatorReward + rewardSettings.createReferralReward + rewardSettings.mintReferralReward + rewardSettings.firstMinterReward);
    }

    function getRewards(bool paidMint, uint256 totalReward) internal pure returns (IRewardSplits.RewardsSettings memory rewardSettings) {
        rewardSettings = getRewardsSettingsPct(paidMint);
        rewardSettings.creatorReward = computeRewardsPct(totalReward, rewardSettings.creatorReward);
        rewardSettings.createReferralReward = computeRewardsPct(totalReward, rewardSettings.createReferralReward);
        rewardSettings.mintReferralReward = computeRewardsPct(totalReward, rewardSettings.mintReferralReward);
        rewardSettings.firstMinterReward = computeRewardsPct(totalReward, rewardSettings.firstMinterReward);
        rewardSettings.freeeReward =
            totalReward -
            (rewardSettings.creatorReward + rewardSettings.createReferralReward + rewardSettings.mintReferralReward + rewardSettings.firstMinterReward);
    }
}

/// @notice Common logic for between ERC-721 & ERC-1155 contracts for protocol reward splits & deposits
abstract contract RewardSplits is IRewardSplits {
    address internal immutable rewardRecipient;
    IProtocolRewards internal immutable protocolRewards;

    constructor(address _protocolRewards, address _rewardRecipient) payable {
        if (_protocolRewards == address(0) || _rewardRecipient == address(0)) {
            revert INVALID_ADDRESS_ZERO();
        }

        protocolRewards = IProtocolRewards(_protocolRewards);
        rewardRecipient = _rewardRecipient;
    }

    function computeTotalReward(uint256 mintPrice, uint256 quantity) public pure returns (uint256) {
        return mintPrice * quantity;
    }
}

File 26 of 55 : IArbInfo.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

interface IArbInfo {
    function configureAutomaticYield() external;
    function configureVoidYield() external;
    function configureDelegateYield(address delegate) external;
}

File 27 of 55 : IERC1155Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165Upgradeable.sol";

/**
 * @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 IERC1155Upgradeable is IERC165Upgradeable {
    /**
     * @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 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;
}

File 28 of 55 : IERC1155ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165Upgradeable.sol";

/**
 * @dev _Available since v3.1._
 */
interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
    /**
     * @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.
     *
     * NOTE: 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.
     *
     * NOTE: 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);
}

File 29 of 55 : IERC1155MetadataURIUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155Upgradeable.sol";

/**
 * @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 IERC1155MetadataURIUpgradeable is IERC1155Upgradeable {
    /**
     * @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);
}

File 30 of 55 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

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

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

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

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 33 of 55 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 34 of 55 : IERC165Upgradeable.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
 * 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 IERC165Upgradeable {
    /**
     * @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);
}

File 35 of 55 : ICreator1155TypesV1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { ITransferHookReceiver } from "../interfaces/ITransferHookReceiver.sol";

/// @notice Interface for types used across the Creator1155 contract
interface ICreator1155TypesV1 {
    /// @notice Used to store individual token data
    struct TokenData {
        string uri;
        uint256 maxSupply;
        uint256 totalMinted;
        bool isSoulbound;
    }

    /// @notice Used to store contract-level configuration
    struct ContractConfig {
        address owner;
        uint96 __gap1;
        address payable fundsRecipient;
        uint96 __gap2;
        ITransferHookReceiver transferHook;
        uint96 __gap3;
    }
}

File 36 of 55 : IOwnable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

interface IOwnable {
    function owner() external returns (address);

    event OwnershipTransferred(address lastOwner, address newOwner);
}

File 37 of 55 : IVersionedContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

interface IVersionedContract {
    function contractVersion() external returns (string memory);
}

File 38 of 55 : ICreatorRoyaltiesControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { IERC2981 } from "@openzeppelin/contracts/interfaces/IERC2981.sol";

interface ICreatorRoyaltiesControl is IERC2981 {
    /// @notice The RoyaltyConfiguration struct is used to store the royalty configuration for a given token.
    /// @param royaltyMintSchedule Every nth token will go to the royalty recipient.
    /// @param royaltyBPS The royalty amount in basis points for secondary sales.
    /// @param royaltyRecipient The address that will receive the royalty payments.
    struct RoyaltyConfiguration {
        uint32 royaltyMintSchedule;
        uint32 royaltyBPS;
        address royaltyRecipient;
    }

    /// @notice Thrown when a user tries to have 100% supply royalties
    error InvalidMintSchedule();

    /// @notice Event emitted when royalties are updated
    event UpdatedRoyalties(uint256 indexed tokenId, address indexed user, RoyaltyConfiguration configuration);

    /// @notice External data getter to get royalties for a token
    /// @param tokenId tokenId to get royalties configuration for
    function getRoyalties(uint256 tokenId) external view returns (RoyaltyConfiguration memory);
}

File 39 of 55 : draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
 * proxy whose upgrades are fully controlled by the current implementation.
 */
interface IERC1822ProxiableUpgradeable {
    /**
     * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
     * address.
     *
     * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
     * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
     * function revert if invoked through a proxy.
     */
    function proxiableUUID() external view returns (bytes32);
}

File 40 of 55 : ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)

pragma solidity ^0.8.2;

import "../beacon/IBeaconUpgradeable.sol";
import "../../interfaces/IERC1967Upgradeable.sol";
import "../../interfaces/draft-IERC1822Upgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/StorageSlotUpgradeable.sol";
import "../utils/Initializable.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 *
 * _Available since v4.1._
 */
abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable {
    function __ERC1967Upgrade_init() internal onlyInitializing {
    }

    function __ERC1967Upgrade_init_unchained() internal onlyInitializing {
    }
    // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
    bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev Returns the current implementation address.
     */
    function _getImplementation() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract");
        StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Perform implementation upgrade
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeTo(address newImplementation) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);
    }

    /**
     * @dev Perform implementation upgrade with additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
        _upgradeTo(newImplementation);
        if (data.length > 0 || forceCall) {
            AddressUpgradeable.functionDelegateCall(newImplementation, data);
        }
    }

    /**
     * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
     *
     * Emits an {Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
        // Upgrades from old implementations will perform a rollback test. This test requires the new
        // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
        // this special case will break upgrade paths from old UUPS implementation to new ones.
        if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) {
            _setImplementation(newImplementation);
        } else {
            try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) {
                require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
            } catch {
                revert("ERC1967Upgrade: new implementation is not UUPS");
            }
            _upgradeToAndCall(newImplementation, data, forceCall);
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
     * validated in the constructor.
     */
    bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     */
    function _getAdmin() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        require(newAdmin != address(0), "ERC1967: new admin is the zero address");
        StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {AdminChanged} event.
     */
    function _changeAdmin(address newAdmin) internal {
        emit AdminChanged(_getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
     */
    bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function _getBeacon() internal view returns (address) {
        return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract");
        require(
            AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),
            "ERC1967: beacon implementation is not a contract"
        );
        StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;
    }

    /**
     * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
     * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
     *
     * Emits a {BeaconUpgraded} event.
     */
    function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);
        if (data.length > 0 || forceCall) {
            AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 41 of 55 : CreatorPermissionStorageV1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

contract CreatorPermissionStorageV1 {
    mapping(uint256 => mapping(address => uint256)) public permissions;

    uint256[50] private __gap;
}

File 42 of 55 : ICreatorPermissionControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/// @notice Generic control interface for bit-based permissions-control
interface ICreatorPermissionControl {
    /// @notice Emitted when permissions are updated
    event UpdatedPermissions(uint256 indexed tokenId, address indexed user, uint256 indexed permissions);

    /// @notice Public interface to get permissions given a token id and a user address
    /// @return Returns raw permission bits
    function getPermissions(uint256 tokenId, address user) external view returns (uint256);
}

File 43 of 55 : CreatorRendererStorageV1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { ICreatorRendererControl } from "../interfaces/ICreatorRendererControl.sol";
import { IRenderer1155 } from "../interfaces/IRenderer1155.sol";

/// @notice Creator Renderer Storage Configuration Contract V1
abstract contract CreatorRendererStorageV1 is ICreatorRendererControl {
    /// @notice Mapping for custom renderers
    mapping(uint256 => IRenderer1155) public customRenderers;

    uint256[50] private __gap;
}

File 44 of 55 : CreatorRoyaltiesStorageV1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { ICreatorRoyaltiesControl } from "../interfaces/ICreatorRoyaltiesControl.sol";

/// @title CreatorRoyaltiesControl
/// @notice Royalty storage contract pattern
abstract contract CreatorRoyaltiesStorageV1 is ICreatorRoyaltiesControl {
    mapping(uint256 => RoyaltyConfiguration) public royalties;

    uint256[50] private __gap;
}

File 45 of 55 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

import "../utils/introspection/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 paid in that same unit of exchange.
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) external view returns (address receiver, uint256 royaltyAmount);
}

File 46 of 55 : ILegacyNaming.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

interface ILegacyNaming {
    function name() external returns (string memory);

    function symbol() external returns (string memory);
}

File 47 of 55 : LegacyNamingStorageV1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

contract LegacyNamingStorageV1 {
    string internal _name;

    uint256[50] private __gap;
}

File 48 of 55 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 49 of 55 : IProtocolRewards.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/// @title IProtocolRewards
/// @notice The interface for deposits & withdrawals for Protocol Rewards
interface IProtocolRewards {
    /// @notice Rewards Deposit Event
    /// @param creator Creator for NFT rewards
    /// @param createReferral Creator referral
    /// @param mintReferral Mint referral user
    /// @param firstMinter First minter reward recipient
    /// @param freee FREEE recipient
    /// @param from The caller of the deposit
    /// @param creatorReward Creator reward amount
    /// @param createReferralReward Creator referral reward
    /// @param mintReferralReward Mint referral amount
    /// @param firstMinterReward First minter reward amount
    /// @param freeeReward FREEE amount
    event RewardsDeposit(
        address indexed creator,
        address indexed createReferral,
        address indexed mintReferral,
        address firstMinter,
        address freee,
        address from,
        uint256 creatorReward,
        uint256 createReferralReward,
        uint256 mintReferralReward,
        uint256 firstMinterReward,
        uint256 freeeReward
    );

    /// @notice Deposit Event
    /// @param from From user
    /// @param to To user (within contract)
    /// @param reason Optional bytes4 reason for indexing
    /// @param amount Amount of deposit
    /// @param comment Optional user comment
    event Deposit(address indexed from, address indexed to, bytes4 indexed reason, uint256 amount, string comment);

    /// @notice Withdraw Event
    /// @param from From user
    /// @param to To user (within contract)
    /// @param amount Amount of deposit
    event Withdraw(address indexed from, address indexed to, uint256 amount);

    /// @notice Cannot send to address zero
    error ADDRESS_ZERO();

    /// @notice Function argument array length mismatch
    error ARRAY_LENGTH_MISMATCH();

    /// @notice Invalid deposit
    error INVALID_DEPOSIT();

    /// @notice Invalid signature for deposit
    error INVALID_SIGNATURE();

    /// @notice Invalid withdraw
    error INVALID_WITHDRAW();

    /// @notice Signature for withdraw is too old and has expired
    error SIGNATURE_DEADLINE_EXPIRED();

    /// @notice Low-level ETH transfer has failed
    error TRANSFER_FAILED();

    /// @notice Generic function to deposit ETH for a recipient, with an optional comment
    /// @param to Address to deposit to
    /// @param to Reason system reason for deposit (used for indexing)
    /// @param comment Optional comment as reason for deposit
    function deposit(address to, bytes4 why, string calldata comment) external payable;

    /// @notice Generic function to deposit ETH for multiple recipients, with an optional comment
    /// @param recipients recipients to send the amount to, array aligns with amounts
    /// @param amounts amounts to send to each recipient, array aligns with recipients
    /// @param reasons optional bytes4 hash for indexing
    /// @param comment Optional comment to include with mint
    function depositBatch(address[] calldata recipients, uint256[] calldata amounts, bytes4[] calldata reasons, string calldata comment) external payable;

    /// @notice Used by ERC-721 & ERC-1155 contracts to deposit protocol rewards
    /// @param creator Creator for NFT rewards
    /// @param creatorReward Creator reward amount
    /// @param createReferral Creator referral
    /// @param createReferralReward Creator referral reward
    /// @param mintReferral Mint referral user
    /// @param mintReferralReward Mint referral amount
    /// @param firstMinter First minter reward
    /// @param firstMinterReward First minter reward amount
    /// @param freee FREEE recipient
    /// @param freeeReward FREEE amount
    function depositRewards(
        address creator,
        uint256 creatorReward,
        address createReferral,
        uint256 createReferralReward,
        address mintReferral,
        uint256 mintReferralReward,
        address firstMinter,
        uint256 firstMinterReward,
        address freee,
        uint256 freeeReward
    ) external payable;

    /// @notice Withdraw protocol rewards
    /// @param to Withdraws from msg.sender to this address
    /// @param amount amount to withdraw
    function withdraw(address to, uint256 amount) external;

    /// @notice Execute a withdraw of protocol rewards via signature
    /// @param from Withdraw from this address
    /// @param to Withdraw to this address
    /// @param amount Amount to withdraw
    /// @param deadline Deadline for the signature to be valid
    /// @param v V component of signature
    /// @param r R component of signature
    /// @param s S component of signature
    function withdrawWithSig(address from, address to, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;
}

File 50 of 55 : IRewardSplits.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

interface IRewardsErrors {
    error CREATOR_FUNDS_RECIPIENT_NOT_SET();
    error INVALID_ADDRESS_ZERO();
    error INVALID_ETH_AMOUNT();
    error ONLY_CREATE_REFERRAL();
}

interface IRewardSplits is IRewardsErrors {
    struct RewardsSettings {
        uint256 creatorReward;
        uint256 createReferralReward;
        uint256 mintReferralReward;
        uint256 firstMinterReward;
        uint256 freeeReward;
    }
}

File 51 of 55 : IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.0;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeaconUpgradeable {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {BeaconProxy} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

File 52 of 55 : IERC1967Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)

pragma solidity ^0.8.0;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 *
 * _Available since v4.8.3._
 */
interface IERC1967Upgradeable {
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);
}

File 53 of 55 : StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlotUpgradeable {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

File 54 of 55 : ICreatorRendererControl.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

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

/// @notice Interface for creator renderer controls
interface ICreatorRendererControl {
    /// @notice Get the custom renderer contract (if any) for the given token id
    /// @dev Reverts if not custom renderer is set for this token
    function getCustomRenderer(uint256 tokenId) external view returns (IRenderer1155 renderer);

    error NoRendererForToken(uint256 tokenId);
    error RendererNotValid(address renderer);

    event RendererUpdated(uint256 indexed tokenId, address indexed renderer, address indexed user);
}

File 55 of 55 : 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
 * 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);
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "forge-std/=lib/forge-std/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "solmate/=lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_mintFeeAmount","type":"uint256"},{"internalType":"address","name":"_mintFeeRecipient","type":"address"},{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_protocolRewards","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"user","type":"address"}],"name":"Burn_NotOwnerOrApproved","type":"error"},{"inputs":[],"name":"CREATOR_FUNDS_RECIPIENT_NOT_SET","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"CallFailed","type":"error"},{"inputs":[],"name":"Call_TokenIdMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"totalMinted","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"CannotMintMoreTokens","type":"error"},{"inputs":[{"internalType":"address","name":"proposedAddress","type":"address"}],"name":"Config_TransferHookNotSupported","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ETHWithdrawFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"contractValue","type":"uint256"}],"name":"FundsWithdrawInsolvent","type":"error"},{"inputs":[],"name":"INVALID_ADDRESS_ZERO","type":"error"},{"inputs":[],"name":"INVALID_ETH_AMOUNT","type":"error"},{"inputs":[],"name":"InvalidMintSchedule","type":"error"},{"inputs":[],"name":"Mint_InsolventSaleTransfer","type":"error"},{"inputs":[],"name":"Mint_TokenIDMintNotAllowed","type":"error"},{"inputs":[],"name":"Mint_UnknownCommand","type":"error"},{"inputs":[],"name":"Mint_ValueTransferFail","type":"error"},{"inputs":[],"name":"NewOwnerNeedsToBeAdmin","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NoRendererForToken","type":"error"},{"inputs":[],"name":"ONLY_CREATE_REFERRAL","type":"error"},{"inputs":[{"internalType":"address","name":"renderer","type":"address"}],"name":"RendererNotValid","type":"error"},{"inputs":[],"name":"Renderer_NotValidRendererContract","type":"error"},{"inputs":[{"internalType":"address","name":"targetContract","type":"address"}],"name":"Sale_CannotCallNonSalesContract","type":"error"},{"inputs":[{"internalType":"uint256","name":"expected","type":"uint256"},{"internalType":"uint256","name":"actual","type":"uint256"}],"name":"TokenIdMismatch","type":"error"},{"inputs":[],"name":"Transfer_NotAllowed","type":"error"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"role","type":"uint256"}],"name":"UserMissingRoleForToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"AdminMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"quantities","type":"uint256[]"}],"name":"AdminMintedBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","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":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"updater","type":"address"},{"indexed":true,"internalType":"enum ICreator1155.ConfigUpdate","name":"updateType","type":"uint8"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint96","name":"__gap1","type":"uint96"},{"internalType":"address payable","name":"fundsRecipient","type":"address"},{"internalType":"uint96","name":"__gap2","type":"uint96"},{"internalType":"contract ITransferHookReceiver","name":"transferHook","type":"address"},{"internalType":"uint96","name":"__gap3","type":"uint96"}],"indexed":false,"internalType":"struct ICreator1155TypesV1.ContractConfig","name":"newConfig","type":"tuple"}],"name":"ConfigUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"updater","type":"address"},{"indexed":false,"internalType":"string","name":"uri","type":"string"},{"indexed":false,"internalType":"string","name":"name","type":"string"}],"name":"ContractMetadataUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IRenderer1155","name":"renderer","type":"address"}],"name":"ContractRendererUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"lastOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"minter","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Purchased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"renderer","type":"address"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"RendererUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"string","name":"newURI","type":"string"},{"indexed":false,"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"SetupNewToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isSoulbound","type":"bool"}],"name":"SetupSoulbound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"permissions","type":"uint256"}],"name":"UpdatedPermissions","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"components":[{"internalType":"uint32","name":"royaltyMintSchedule","type":"uint32"},{"internalType":"uint32","name":"royaltyBPS","type":"uint32"},{"internalType":"address","name":"royaltyRecipient","type":"address"}],"indexed":false,"internalType":"struct ICreatorRoyaltiesControl.RoyaltyConfiguration","name":"configuration","type":"tuple"}],"name":"UpdatedRoyalties","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"totalMinted","type":"uint256"},{"internalType":"bool","name":"isSoulbound","type":"bool"}],"indexed":false,"internalType":"struct ICreator1155TypesV1.TokenData","name":"tokenData","type":"tuple"}],"name":"UpdatedToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"CONTRACT_BASE_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMISSION_BIT_ADMIN","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMISSION_BIT_FUNDS_MANAGER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMISSION_BIT_METADATA","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMISSION_BIT_MINTER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMISSION_BIT_SALES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"permissionBits","type":"uint256"}],"name":"addPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"adminMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"quantities","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"adminMintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"lastTokenId","type":"uint256"}],"name":"assumeLastTokenIdMatches","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"burnBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"callRenderer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"contract IMinter1155","name":"salesConfig","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"callSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mintPrice","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"computeTotalReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"config","outputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint96","name":"__gap1","type":"uint96"},{"internalType":"address payable","name":"fundsRecipient","type":"address"},{"internalType":"uint96","name":"__gap2","type":"uint96"},{"internalType":"contract ITransferHookReceiver","name":"transferHook","type":"address"},{"internalType":"uint96","name":"__gap3","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"createReferrals","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"customRenderers","outputs":[{"internalType":"contract IRenderer1155","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"firstMinters","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCreatorRewardRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getCustomRenderer","outputs":[{"internalType":"contract IRenderer1155","name":"customRenderer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getPermissions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getRoyalties","outputs":[{"components":[{"internalType":"uint32","name":"royaltyMintSchedule","type":"uint32"},{"internalType":"uint32","name":"royaltyBPS","type":"uint32"},{"internalType":"address","name":"royaltyRecipient","type":"address"}],"internalType":"struct ICreatorRoyaltiesControl.RoyaltyConfiguration","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenInfo","outputs":[{"components":[{"internalType":"string","name":"uri","type":"string"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"totalMinted","type":"uint256"},{"internalType":"bool","name":"isSoulbound","type":"bool"}],"internalType":"struct ICreator1155TypesV1.TokenData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"contractName","type":"string"},{"internalType":"string","name":"newContractURI","type":"string"},{"components":[{"internalType":"uint32","name":"royaltyMintSchedule","type":"uint32"},{"internalType":"uint32","name":"royaltyBPS","type":"uint32"},{"internalType":"address","name":"royaltyRecipient","type":"address"}],"internalType":"struct ICreatorRoyaltiesControl.RoyaltyConfiguration","name":"defaultRoyaltyConfiguration","type":"tuple"},{"internalType":"address payable","name":"defaultAdmin","type":"address"},{"internalType":"bytes[]","name":"setupActions","type":"bytes[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"role","type":"uint256"}],"name":"isAdminOrRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"metadataRendererContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IMinter1155","name":"minter","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bytes","name":"minterArguments","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IMinter1155","name":"minter","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"address[]","name":"rewardsRecipients","type":"address[]"},{"internalType":"bytes","name":"minterArguments","type":"bytes"}],"name":"mintWithRewards","outputs":[],"stateMutability":"payable","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":"nextTokenId","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":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"permissions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"permissionBits","type":"uint256"}],"name":"removePermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"royalties","outputs":[{"internalType":"uint32","name":"royaltyMintSchedule","type":"uint32"},{"internalType":"uint32","name":"royaltyBPS","type":"uint32"},{"internalType":"address","name":"royaltyRecipient","type":"address"}],"stateMutability":"view","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":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","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":"address payable","name":"fundsRecipient","type":"address"}],"name":"setFundsRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isSoulbound","type":"bool"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"setSoulbound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"contract IRenderer1155","name":"renderer","type":"address"}],"name":"setTokenMetadataRenderer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ITransferHookReceiver","name":"transferHook","type":"address"}],"name":"setTransferHook","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"bool","name":"isSoulbound","type":"bool"}],"name":"setupNewToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"address","name":"createReferral","type":"address"},{"internalType":"bool","name":"isSoulbound","type":"bool"}],"name":"setupNewTokenWithCreateReferral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"mintAmount","type":"uint256"}],"name":"supplyRoyaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","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":"pure","type":"function"},{"inputs":[{"internalType":"string","name":"_newURI","type":"string"},{"internalType":"string","name":"_newName","type":"string"}],"name":"updateContractMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"updateCreateReferral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint32","name":"royaltyMintSchedule","type":"uint32"},{"internalType":"uint32","name":"royaltyBPS","type":"uint32"},{"internalType":"address","name":"royaltyRecipient","type":"address"}],"internalType":"struct ICreatorRoyaltiesControl.RoyaltyConfiguration","name":"newConfiguration","type":"tuple"}],"name":"updateRoyaltiesForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"_newURI","type":"string"}],"name":"updateTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101403461023b57601f615fdd38819003918201601f1916830191906001600160401b0383118484101761024057816080928592604095865283398101031261023b5781519061005160208401610256565b6100686060610061848701610256565b9501610256565b3060805261271060a0526001600160a01b039190821680158015610231575b6102205760e05260c0526000549060ff8260081c161591828093610213575b80156101fc575b156101a15760ff1981166001176000558261018f575b5061012093845261010094168452610155575b5190615d72928361026b84396080518381816126df015281816127cf0152612c85015260a0518361319c015260c051838181614a6001528181614f7d01528181614fa501528181614fce0152614ff5015260e0518381816149db0152614a9f0152518281816128530152612d1401525181818161376601526148270152f35b61ff0019600054166000557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024986020825160018152a16100d6565b61ffff191661010117600055386100c3565b835162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b1580156100ad5750600160ff8216146100ad565b50600160ff8216106100a6565b8351632d87658960e01b8152600490fd5b5082821615610087565b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361023b5756fe6080604052600436101561001b575b361561001957600080fd5b005b6000803560e01c8062fdd58e146136b2578063011442011461369657806301ffc9a7146135f557806306fdde031461350d5780630e89341c146134ed57806310a7eb5d146134c257806313966db514610bf057806313af40351461345a57806317bd48bb146133e957806318711c7d146133cd57806318e97fd11461322e57806323bd0386146131e05780632a55205a1461316a5780632eb2c2d614612ebd578063300ecdb914612bb55780633659cfe614612c605780633ccfd60b14612bfa5780634913162d14612bb55780634e1273f414612a6d5780634f1ef2861461279057806352d1902d146126cc5780635c60da1b146126965780635d0f6cba146125475780635e4e0404146125285780636661a9ba146123bb57806369a5b302146123875780636b20c4541461202d578063731133e914611fcf57806375794a3c14611fb057806379502c5514611f565780637dafae4d14611f225780637f2dc61c14611e405780637f77f57414611df057806384ac319114611d5f5780638621ea4b14611d1f5780638a08eb4c146117415780638c7a63ae146116b95780638da5cb5b1461168f5780638ec998a01461162f578063929a71281461161457806395d89b41146115b55780639993eae11461153e5780639c5c63c9146114a55780639ebb832414611471578063a0a8e4601461142b578063a22cb4651461133e578063a453eaf014611322578063a457c67314611300578063ac9650d814611268578063afed7e9e14611098578063bb3bafd614611040578063bf2435b914610fc2578063c046435614610fa6578063c238d1ee14610f08578063d1ad846b14610bf5578063d7bf81a314610bf0578063d904b94a14610a26578063da46243114610942578063dd15e05f1461090e578063e72878b4146108c8578063e74d86c214610897578063e8a3d48514610863578063e985e9c51461080f578063ef71c82e1461059e578063f1b0d6bb146105825763f242432a146102fc575061000e565b3461057f5760a036600319011261057f576103156136da565b9061031e6136f0565b9160443590606435906084356001600160401b03811161057b57610346903690600401613891565b9160018060a01b039361039284868516963388148015610554575b61036a90613d66565b8916946103788615156146f8565b61038184615bb3565b8a61038b87615bb3565b9233615658565b8086526020966097885260408720866000528852826040600020546103b982821015614752565b83895260978a5260408920886000528a5203604060002055818752609788526040872084600052885260406000206103f2848254613f74565b90558386604051848152858b8201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6260403392a43b610430578580f35b916104769391600088946040519687958694859363f23a6e6160e01b9b8c865233600487015260248601526044850152606484015260a0608484015260a4830190613729565b03925af160009181610525575b506104ee57836104916157bc565b6308c379a0146104b9575b60405162461bcd60e51b8152806104b560048201615848565b0390fd5b6104c16157da565b90816104cd575061049c565b6104b560405192839262461bcd60e51b845260048401526024830190613729565b9192506001600160e01b03199091160361050c578038808080808580f35b60405162461bcd60e51b8152806104b560048201615773565b610546919250853d871161054d575b61053e818361381e565b810190615753565b9038610483565b503d610534565b508789526098602052604089203360005260205261036a60ff604060002054169050610361565b8480fd5b80fd5b503461057f578060031936011261057f57602060405160048152f35b503461057f57604036600319011261057f576001600160401b0360043581811161080b576105d0903690600401613891565b602435828111610807576105e8903690600401613891565b336000908152600080516020615d1d833981519152602090815260409091205491939091601216158015906101fe906107e3575b50156107bd578480526101c68252604085209083519081116107a9576106428254613b1e565b601f8111610766575b5082601f82116001146106dd57927f74b7c2afa3f89c562b59674a101e2c48bceeb27cdb620afefa14446f1ffa487b9492826106cc936106bd968a916106d2575b508160011b916000199060031b1c19161790555b6106a986615373565b604051938493604085526040850190613729565b90838203908401523395613729565b0390a280f35b90508501513861068c565b82875283872090601f198316885b81811061074f5750836106bd96937f74b7c2afa3f89c562b59674a101e2c48bceeb27cdb620afefa14446f1ffa487b9896936106cc9660019410610736575b5050811b0190556106a0565b87015160001960f88460031b161c19169055388061072a565b91928660018192868b0151815501940192016106eb565b828752838720601f830160051c81019185841061079f575b601f0160051c01905b818110610794575061064b565b878155600101610787565b909150819061077e565b634e487b7160e01b86526041600452602486fd5b604051634baa2a4d60e01b81523360048201526000602482015260106044820152606490fd5b9050600080528252604060002033600052825260126040600020541615153861061c565b8380fd5b8280fd5b503461057f57604036600319011261057f576108296136da565b60406108336136f0565b9260018060a01b0380931681526098602052209116600052602052602060ff604060002054166040519015158152f35b503461057f578060031936011261057f5761089361087f61426a565b604051918291602083526020830190613729565b0390f35b503461057f57602036600319011261057f5760206108b66004356141ca565b6040516001600160a01b039091168152f35b503461057f57602036600319011261057f576004356000196101c854018181036108f0578280f35b6044925060405191634fa09b3f60e01b835260048301526024820152fd5b503461057f57602036600319011261057f57602090600435815261012d8252604060018060a01b0391205416604051908152f35b503461057f57604036600319011261057f5760043580151590818103610a215760243591826000526101fe91602092808452604060002033600052845260026040600020541615908115916109fd575b50156109d757906109cd600080516020615c9d83398151915293928587526101c68452600360408820019060ff801983541691151516179055565b604051908152a280f35b604051634baa2a4d60e01b81523360048201526024810185905260026044820152606490fd5b90506000805283526040600020336000528352600260406000205416151538610992565b600080fd5b503461057f57606036600319011261057f57600435610a436136f0565b906044356001600160401b03811161080757610a63903690600401613a31565b91806000526101fe936020948086526040600020336000528652600a604060002054161590811591610bcc575b5015610ba6576001600160a01b031690610aaa818361449a565b6040516301ffc9a760e01b8152636890e5b360e01b60048201528581602481865afa908115610b9b578791610b6e575b5015610b555783602411610b5157600483013503610b3f57828580949381946040519384928337810182815203925af190610b13613ff3565b9115610b1d578280f35b6104b560405192839263a5fa8d2b60e01b845260048401526024830190613729565b60405163fe486c2b60e01b8152600490fd5b8580fd5b6040516370adc70360e11b815260048101839052602490fd5b610b8e9150863d8811610b94575b610b86818361381e565b810190613ef6565b38610ada565b503d610b7c565b6040513d89823e3d90fd5b604051634baa2a4d60e01b81523360048201526024810183905260086044820152606490fd5b90506000805285526040600020336000528552600a60406000205416151538610a90565b61374e565b503461057f57600319608036820112610f0457610c106136da565b6001600160401b0392602435848111610f0457610c3190369060040161392a565b9160443585811161080b57610c4a90369060040161392a565b9460643590811161080b57610c63903690600401613891565b93610c6c6147b1565b8280526020926101fe8452604081203360005284526006604060002054161596815b8651811015610cbf5760019089610ca6575b01610c8e565b610cba610cb3828a613eae565b513361449a565b610ca0565b5086959394958451835b818110610eab5750506001600160a01b03861693610ce8851515615b5d565b610cf5865184511461469b565b610d028284888a3361554b565b835b8651811015610d4e5780610d1a60019286613eae565b51610d25828a613eae565b51875260978b5260408720886000528b52610d466040600020918254613f74565b905501610d04565b50879695939585876040517f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb339180610d888a8c836141a5565b0390a43b610dd1575b5050610dc67fc0d6da87a629809c1b871e1d2d54452fae1988bf4e85d2c82f51246281b6173c916040519182913395836141a5565b0390a3600160655580f35b86610e2c916040518093819263bc197c8160e01b968784523360048501526000602485015260a06044850152610e1d610e0d60a486018c6139a3565b838682030160648701528a6139a3565b91848303016084850152613729565b03816000895af160009181610e8c575b50610e4a57866104916157bc565b9091929394955063ffffffff60e01b160361050c5783929190610dc67fc0d6da87a629809c1b871e1d2d54452fae1988bf4e85d2c82f51246281b6173c610d91565b610ea4919250883d8a1161054d5761053e818361381e565b9088610e3c565b80610ecd610ebb6001938a613eae565b51610ec68388613eae565b5190615b02565b610ed78186613eae565b51610ee2828a613eae565b5187526101c68b52610efc60026040892001918254613f74565b905501610cc9565b5080fd5b503461057f57608036600319011261057f57610f226136da565b60243590604435906064356001600160401b03811161057b57610f4c610f66913690600401613891565b610f546147b1565b610f5e853361449a565b83858461592d565b6040519182526001600160a01b03169033907f78dab3a57c593d7cff5047cf6f6eedd10503cf2958b842f3eb39b363d457a4db90602090a4600160655580f35b503461057f578060031936011261057f57602060405160028152f35b5060a036600319011261057f57610fd76136da565b6001600160401b039060643582811161080757610ff8903690600401613a01565b909160843593841161057b5761102a611018611038953690600401613a31565b9490936110236147b1565b3691613945565b906044359060243590614807565b600160655580f35b503461057f57602036600319011261057f57610893611060600435614102565b60408051825163ffffffff908116825260208085015190911690820152918101516001600160a01b0316908201529081906060820190565b503461057f57608036600319011261057f576004356060366023190112610a2157604051906110c6826137cd565b63ffffffff6024358181168103610a215783526044358181168103610a21576020848101918252606435906001600160a01b038083168303610a215760408701928352856000526101fe80835260406000203360005283526022604060002054161590811591611244575b50156112205784875116611217575b825116158061120b575b6111f95784600052610160815267ffffffff000000006040600020948751169185549451901b169168010000000000000000600160e01b03905160401b169263ffffffff60e01b1617171790557f5837d55897cfc337f160a71d7b63a047abd50a3a8834f1c5d70f338846358c6d604051806111f33395829190916040606082019363ffffffff80825116845260208201511660208401528160018060a01b0391015116910152565b0390a380f35b604051630d9b92f160e01b8152600490fd5b5083835116151561114a565b60008752611140565b6064868360405191634baa2a4d60e01b835233600484015260248301526044820152fd5b90506000805282526040600020336000528252602260406000205416151538611131565b503461057f57602080600319360112610f04576004356001600160401b03811161080b576112a461129e84923690600401613a01565b90614023565b60405191838301848452825180915260408401948060408360051b870101940192955b8287106112d45785850386f35b9091929382806112f0600193603f198a82030186528851613729565b96019201960195929190926112c7565b503461057f57602061131a611314366138af565b90613d1d565b604051908152f35b503461057f578060031936011261057f57602060405160108152f35b503461057f57604036600319011261057f576113586136da565b6024359081151590818303610a21576001600160a01b0316913383146113d4576113a5903385526098602052604085208460005260205260406000209060ff801983541691151516179055565b6040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b60405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608490fd5b503461057f578060031936011261057f5761089360405161144b816137e8565b6005815264322e302e3160d81b6020820152604051918291602083526020830190613729565b503461057f57602036600319011261057f5760209060043581526102328252604060018060a01b0391205416604051908152f35b503461057f57604036600319011261057f57806024356004356001600160401b03821161153a576114db83923690600401613891565b906114e6813361438d565b6001600160a01b03906114f8906141ca565b1682602083519301915af161150b613ff3565b9015611515575080f35b60405163a5fa8d2b60e01b8152602060048201529081906104b5906024830190613729565b5050fd5b503461057f57606036600319011261057f576004356001600160401b038111610f045761156f903690600401613a31565b6044358015158103610a21576020926115a89261158b33614414565b6115936147b1565b6115a3339260243592369161385a565b61501b565b6001606555604051908152f35b503461057f578060031936011261057f576040516020808252816060519182602083015260005b8381106115fe5750508160006040809484010152601f80199101168101030190f35b60808101518582016040015284925081016115dc565b503461057f578060031936011261057f576020604051818152f35b503461057f5761163e366139d7565b9161164981336145c4565b60008181526101fe602090815260408083206001600160a01b039590951680845294909152812080549490941793849055600080516020615cdd8339815191529080a480f35b503461057f578060031936011261057f576101c9546040516001600160a01b039091168152602090f35b503461057f57602036600319011261057f5760408161089392606083516116df816137b2565b8181528260208201528285820152015260043581526101c66020522060ff60036040519261170c846137b2565b61171581613b58565b845260018101546020850152600281015460408501520154161515606082015260405191829182613a5e565b503461057f5760e036600319011261057f576004356001600160401b038111610f0457611772903690600401613891565b906024356001600160401b038111610f0457611792903690600401613891565b916060366043190112610f04576040516117ab816137cd565b60443563ffffffff8116810361080757815260643563ffffffff811681036108075760208201526084356001600160a01b038116810361080757604082015260a4356001600160a01b038116900361080b5760c4356001600160401b0381116108075761181c903690600401613a01565b9190926118276147b1565b84549560ff8760081c161596878098611d12575b8015611cfb575b15611c9f5760ff198116600117875587611c8e575b5061187a60ff875460081c1661186c81615313565b61187581615313565b615313565b600160655561189360a4356001600160a01b03166154bf565b6101c890815491600183019055604051906118ad826137b2565b81528660208201528660408201528660608201528187526101c66020526040872081518051906001600160401b038211611c7a579082916118f086959454613b1e565b601f8111611c26575b50602090601f8311600114611bb85761195b9392918c9183611bad575b50508160011b916000199060031b1c19161781555b602083015160018201556040830151600282015560036060840151151591019060ff801983541691151516179055565b7f323bc81dbd896aad1241aab7ac995a86244a273b7b4ac5263224b966cfd128356040518061198b339482613a5e565b0390a3600080516020615c9d8339815191526020604051888152a263ffffffff825116611ba5575b60408201516001600160a01b03161580611b92575b6111f9578480526101606020908152604080872084518154868501805197850180516001600160e01b031990931663ffffffff94851690811799881b67ffffffff00000000169990991792861b68010000000000000000600160e01b03169290921790935583519687529151169285019290925290516001600160a01b031690830152611a9d91339086907f5837d55897cfc337f160a71d7b63a047abd50a3a8834f1c5d70f338846358c6d90606090a3611a8d60a4356001600160a01b0316614626565b611a9860a4356144fc565b615373565b80611b30575b505060653b1561057f5760405163388a0bbd60e11b815281816004818360655af18015611b2557611b16575b5090611add57600160655580f35b61ff001981541681557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1611038565b611b1f90613789565b38611acf565b6040513d84823e3d90fd5b611b4291611b3d336154bf565b614023565b508080526101fe806020526040822033835260205260021960408320541690828052602052604082203383526020528060408320553382600080516020615cdd8339815191528180a43880611aa3565b5063ffffffff60208301511615156119c8565b8482526119b3565b015190503880611916565b90838c5260208c20918c5b601f1985168110611c0b575091839160019361195b9695601f19811610611bf2575b505050811b01815561192b565b015160001960f88460031b161c19169055388080611be5565b81830151845588975060019093019260209283019201611bc3565b909192809495508b5260208b20601f840160051c810160208510611c73575b90879695949392915b8d601f840160051c83018210611c66575050506118f9565b8155889750600101611c4e565b5080611c45565b634e487b7160e01b8a52604160045260248afd5b61ffff191661010117865538611857565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b1580156118425750600160ff821614611842565b50600160ff82161061183b565b503461057f57606036600319011261057f57611d42604435602435600435613f81565b604080516001600160a01b03939093168352602083019190915290f35b503461057f57608036600319011261057f576004356001600160401b038111610f0457611d90903690600401613a31565b91906044356001600160a01b038116919082900361080b5760643593841515850361080757602094604092611dc89261158b33614414565b8084526102318552922080546001600160a01b03191690911790556001606555604051908152f35b503461057f57602036600319011261057f5760406060916004358152610160602052205463ffffffff906040519180821683528160201c16602083015260018060a01b039060401c166040820152f35b503461057f57602036600319011261057f576004356001600160a01b03811690819003610f0457611e703361453e565b80611eab575b6101cb906001600160601b0360a01b8254161790556002604051600080516020615cbd8339815191523391806111f381613f2e565b6040516301ffc9a760e01b8152634058856760e11b6004820152602081602481855afa908115611f17578391611ef8575b50611e76576024906040519062be74ab60e51b82526004820152fd5b611f11915060203d602011610b9457610b86818361381e565b38611edc565b6040513d85823e3d90fd5b503461057f57602036600319011261057f5760209060043581526102318252604060018060a01b0391205416604051908152f35b503461057f578060031936011261057f5760c06101c95460018060a01b036101ca54906101cb549160405193828116855260a01c6020850152818116604085015260a01c60608401528116608083015260a01c60a0820152f35b503461057f578060031936011261057f5760206101c854604051908152f35b50608036600319011261057f57611fe46136da565b606435906001600160401b03821161080b57612007611038923690600401613a31565b916120106147b1565b6040519061201d82613803565b8582526044359060243590614807565b503461057f57600319606036820112610f04576120486136da565b602491602435936001600160401b0394858111610f045761206d903690600401613a01565b9490936044966044359081116108075761208b903690600401613a01565b9560018060a01b0397888416933385141580612366575b61233d57506120bf92916120b79136916138dc565b9636916138dc565b9381156122ec576120d3865186511461469b565b604051906120e082613803565b84825284976101cb54169182612245575b505050855b8551811015612149576121098187613eae565b5187526101c660205260ff60036040892001541680612141575b61212f576001016120f6565b604051633518113960e01b8152600490fd5b506001612123565b5086949394835b85518110156121fd576121638187613eae565b5161216e8289613eae565b5190808752609760209080825260408920878a5282526040892054928484106121af57895281526040808920878a5290915287209190039055600101612150565b6084837f455243313135353a206275726e20616d6f756e7420657863656564732062616c898c6040519362461bcd60e51b855260048501528084015282015263616e636560e01b6064820152fd5b848084887f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb6122348c6040519182913395836141a5565b0390a4612242604051613803565b80f35b823b15610b515786928887866122b88296612299966122a96040519a8b998a988997634058856760e11b89523060048a01523360248a0152604489015288606489015260e0608489015260e48801906139a3565b90848783030160a48801526139a3565b918483030160c4850152613729565b03925af180156122e1576122ce575b80806120f1565b6122d9919650613789565b8194386122c7565b6040513d86823e3d90fd5b60405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b6040516341ce11f960e11b81523360048201526001600160a01b03919091166024820152604490fd5b5084875260986020526040872033885260205260ff604088205416156120a2565b503461057f57602036600319011261057f5760209060043581526101c78252604060018060a01b0391205416604051908152f35b503461057f57604036600319011261057f576004356024356001600160a01b0381169081900361080b576123ed6147b1565b6123f7823361438d565b81835261012d60209081526040842080546001600160a01b0319168317905590806124b3575b6040513382857f5010f780a0de79bcfb9f3d6fec3cfe29758ef5c5800d575af709bc590bd78ade8880a484846124815750507f56e810c8cae84731149f628981d25769a084570b9ba6eebf3c32879e3dce56099250604051908152a1600160655580f35b60409250837f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b948352820152a2611038565b6040516301ffc9a760e01b8152633de3f32360e11b60048201528281602481855afa90811561251d578591612500575b5061241d576024906040519063da755beb60e01b82526004820152fd5b6125179150833d8511610b9457610b86818361381e565b386124e3565b6040513d87823e3d90fd5b503461057f57602036600319011261057f5760206108b6600435613ec2565b503461057f5780612557366139d7565b916001600160a01b0391821633811480612674575b15612665575b8185526101fe9160209483865260408720838852865260408720549019168187528386526040872083885286528060408820558282600080516020615cdd8339815191528980a4159182612656575b82612635575b50506125d1575050f35b7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0926040926101c9928354936001600160601b0360a01b85169055845193168352820152a180604051600080516020615cbd8339815191523391806111f381613f2e565b909150848052835260408420908452825260026040842054161538806125c7565b6101c9548416821492506125c1565b61266f82336145c4565b612572565b508185526101fe6020526040852033865260205283806040872054161461256c565b503461057f578060031936011261057f57600080516020615cfd833981519152546040516001600160a01b039091168152602090f35b503461057f578060031936011261057f577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163003612725576020604051600080516020615cfd8339815191528152f35b60405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608490fd5b50604036600319011261057f576127a56136da565b6024356001600160401b03811161080b576127c582913690600401613891565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116906127fd30831415613dc9565b600080516020615cfd8339815191529161281c82845416918214613e2a565b6128253361453e565b6040516321f7434760e01b81526001600160a01b0391821660048201529516602486015260209485816044817f000000000000000000000000000000000000000000000000000000000000000086165afa908115610b9b578791612a50575b5015610b51577f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156128c157505050612242915061589d565b83929316906040516352d1902d60e01b81528581600481865afa879181612a1d575b506129445760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b949394036129c6576129558261589d565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8580a2838351158015906129be575b612991575b5050505080f35b806129b49461299e615502565b9481519101845af46129ae613ff3565b91615c27565b503880808361298a565b506001612985565b60405162461bcd60e51b815260048101849052602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b9091508681813d8311612a49575b612a35818361381e565b81010312612a45575190386128e3565b8780fd5b503d612a2b565b612a679150863d8811610b9457610b86818361381e565b38612884565b503461057f57604036600319011261057f576001600160401b0360043581811161080b573660238201121561080b57612ab0903690602481600401359101613945565b9060243590811161080b57612ac990369060040161392a565b8151815103612b5e57815192612ade846138c5565b93612aec604051958661381e565b808552612afb601f19916138c5565b013660208601375b8251811015612b4857600190612b376001600160a01b03612b248387613eae565b5116612b308386613eae565b5190613a99565b612b418287613eae565b5201612b03565b60405160208082528190610893908201876139a3565b60405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608490fd5b503461057f57604036600319011261057f576040602091612bd46136f0565b60043582526101fe84528282206001600160a01b03909116825283522054604051908152f35b503461057f578060031936011261057f57612c1433614307565b4760018060a01b036101ca8380808086868654166204baf0f1612c35613ff3565b5015612c3f578380f35b604493505416906040519163292264c360e21b835260048301526024820152fd5b503461057f57602080600319360112610f0457612c7b6136da565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116612cb230821415613dc9565b612d0f8484600080516020615cfd83398151915293612cd686865416918214613e2a565b612cdf3361453e565b6040516321f7434760e01b81526001600160a01b0391821660048201529116602482015291829081906044820190565b0381867f0000000000000000000000000000000000000000000000000000000000000000165afa908115612eb2578691612e95575b501561057b5760405191612d5783613803565b8583527f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612d9157505050612242915061589d565b83929316906040516352d1902d60e01b81528581600481865afa879181612e66575b50612e145760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b949394036129c657612e258261589d565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8580a283835115801590612e5f57612991575050505080f35b5080612985565b9091508681813d8311612e8e575b612e7e818361381e565b81010312612a4557519038612db3565b503d612e74565b612eac9150853d8711610b9457610b86818361381e565b38612d44565b6040513d88823e3d90fd5b503461057f5760031960a036820112610f0457612ed86136da565b90612ee16136f0565b9183604435926001600160401b039384811161080b57612f0590369060040161392a565b9060643585811161080757612f1e90369060040161392a565b9460843590811161080757612f37903690600401613891565b90612f7f8287858a60018060a01b03612f5e818c169a338c14908115613149575b50613d66565b612f6b835185511461469b565b811699612f798b15156146f8565b33615658565b875b888451821015613006575080612f9960019286613eae565b51612fa4828a613eae565b5190808c5260976020918183528d8a60408220915283528d60408581832054612fcf82821015614752565b8484528587528d8385209085528752039120558d52815260408c2090898d5252612ffe60408c20918254613f74565b905501612f81565b959050869186898388887f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb604051806130418b3395836141a5565b0390a43b61304c5780f35b610e1d9561309c61308c93602097604051998a988997889663bc197c8160e01b9e8f89523360048a0152602489015260a0604489015260a48801906139a3565b90848783030160648801526139a3565b03925af1839181613128575b5061310f576130b56157bc565b6308c379a0146130d85760405162461bcd60e51b8152806104b560048201615848565b6130e06157da565b806130eb575061049c565b60405162461bcd60e51b8152602060048201529081906104b5906024830190613729565b6001600160e01b0319160361050c578180808080808680f35b61314291925060203d60201161054d5761053e818361381e565b90846130a8565b60ff9150808d6040925260986020528181203382526020522054168f612f58565b503461057f576131896131c161319a613182366138af565b9390614102565b9263ffffffff602085015116613d1d565b7f000000000000000000000000000000000000000000000000000000000000000090613d46565b60409182015182516001600160a01b0390911681526020810191909152f35b503461057f57606036600319011261057f576020906131fd6136da565b60243582526101fe8352604082209060018060a01b0316825282526040604435600217912054161515604051908152f35b503461057f57604036600319011261057f576001600160401b039060043560243583811161080b57613264903690600401613891565b9261326f823361438d565b811561080b5760405191807f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b602094858152806132ae8782018a613729565b0390a283526101c68252604083209184519182116133b9576132d08354613b1e565b601f8111613376575b5080601f83116001146133145750839482939492613309575b50508160011b916000199060031b1c191617905580f35b0151905038806132f2565b90601f198316958486528286209286905b88821061335e57505083600195969710613345575b505050811b01905580f35b015160001960f88460031b161c1916905538808061333a565b80600185968294968601518155019501930190613325565b838552818520601f840160051c8101918385106133af575b601f0160051c01905b8181106133a457506132d9565b858155600101613397565b909150819061338e565b634e487b7160e01b84526041600452602484fd5b503461057f578060031936011261057f57602060405160088152f35b503461057f57604036600319011261057f576004356134066136f0565b8183526102316020819052604084205491926001600160a01b0392831633036134485784526020526040832091166001600160601b0360a01b82541617905580f35b604051632afb0ecf60e01b8152600490fd5b503461057f57602036600319011261057f576134746136da565b61347d3361453e565b8180526101fe602090815260408084206001600160a01b0384168552909152822054600216156134b05761224290614626565b60405163131dd3a760e31b8152600490fd5b503461057f57602036600319011261057f576122426134df6136da565b6134e833614307565b6144fc565b503461057f57602036600319011261057f5761089361087f600435613cab565b503461057f578060031936011261057f5760405190808261019392835461353381613b1e565b93848452602095600192876001821691826000146135d1575050600114613578575b5050506135649250038361381e565b610893604051928284938452830190613729565b8152859250907ffc8af01f449989052b52093a58fc9f42d0b11f0c6dd5dca0463dab62346ccc685b8583106135b95750506135649350820101388080613555565b805483890185015287945086939092019181016135a0565b93509450505061356494915060ff191682840152151560051b820101388080613555565b503461057f57602036600319011261057f5760043563ffffffff60e01b8116809103610f045760209063152a902d60e11b8114908115613685575b8115613642575b506040519015158152f35b636cdb3d1360e11b811491508115613674575b8115613663575b5082613637565b6301ffc9a760e01b1490508261365c565b6303a24d0760e21b81149150613655565b63023a443960e31b81149150613630565b503461057f578060031936011261057f57602090604051908152f35b503461057f57604036600319011261057f57602061131a6136d16136da565b60243590613a99565b600435906001600160a01b0382168203610a2157565b602435906001600160a01b0382168203610a2157565b60005b8381106137195750506000910152565b8181015183820152602001613709565b9060209161374281518092818552858086019101613706565b601f01601f1916010190565b34610a21576000366003190112610a215760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b6001600160401b03811161379c57604052565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b0382111761379c57604052565b606081019081106001600160401b0382111761379c57604052565b604081019081106001600160401b0382111761379c57604052565b602081019081106001600160401b0382111761379c57604052565b90601f801991011681019081106001600160401b0382111761379c57604052565b6001600160401b03811161379c57601f01601f191660200190565b9291926138668261383f565b91613874604051938461381e565b829481845281830111610a21578281602093846000960137010152565b9080601f83011215610a21578160206138ac9335910161385a565b90565b6040906003190112610a21576004359060243590565b6001600160401b03811161379c5760051b60200190565b92916138e7826138c5565b916138f5604051938461381e565b829481845260208094019160051b8101928311610a2157905b82821061391b5750505050565b8135815290830190830161390e565b9080601f83011215610a21578160206138ac933591016138dc565b9291613950826138c5565b9161395e604051938461381e565b829481845260208094019160051b8101928311610a2157905b8282106139845750505050565b81356001600160a01b0381168103610a21578152908301908301613977565b90815180825260208080930193019160005b8281106139c3575050505090565b8351855293810193928101926001016139b5565b6060906003190112610a2157600435906024356001600160a01b0381168103610a21579060443590565b9181601f84011215610a21578235916001600160401b038311610a21576020808501948460051b010111610a2157565b9181601f84011215610a21578235916001600160401b038311610a215760208381860195010111610a2157565b6020815260806060613a7b845183602086015260a0850190613729565b93602081015160408501526040810151828501520151151591015290565b6001600160a01b0316908115613ac657600052609760205260406000209060005260205260406000205490565b60405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b6064820152608490fd5b90600182811c92168015613b4e575b6020831014613b3857565b634e487b7160e01b600052602260045260246000fd5b91607f1691613b2d565b90604051918260008254613b6b81613b1e565b90818452602094600191600181169081600014613bdb5750600114613b9c575b505050613b9a9250038361381e565b565b600090815285812095935091905b818310613bc3575050613b9a9350820101388080613b8b565b85548884018501529485019487945091830191613baa565b92505050613b9a94925060ff191682840152151560051b820101388080613b8b565b60008080526101c680602052613c166040832054613b1e565b613c98575080805261012d60205260408120546001600160a01b0390829082168015613c93575b6024604051809481936303a24d0760e21b8352856004840152165afa918215613c87578092613c6b57505090565b6138ac92503d8091833e613c7f818361381e565b810190614234565b604051903d90823e3d90fd5b613c3d565b81604091816138ac945260205220613b58565b6000908082526101c680602052613cc56040842054613b1e565b613d0a5750816001600160a01b03613cdc836141ca565b16916024604051809481936303a24d0760e21b835260048301525afa918215613c87578092613c6b57505090565b916138ac92604092825260205220613b58565b81810292918115918404141715613d3057565b634e487b7160e01b600052601160045260246000fd5b8115613d50570490565b634e487b7160e01b600052601260045260246000fd5b15613d6d57565b60405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b6064820152608490fd5b15613dd057565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b15613e3157565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b805115613e985760200190565b634e487b7160e01b600052603260045260246000fd5b8051821015613e985760209160051b010190565b6001600160a01b03908190604090613ed990614102565b01511680613ef157506101ca5416806138ac57503090565b905090565b90816020910312610a2157518015158103610a215790565b60031115613f1857565b634e487b7160e01b600052602160045260246000fd5b6101c9546001600160a01b03808216835260a091821c60208401526101ca548082166040850152821c60608401526101cb549081166080840152811c9082015260c00190565b91908201809211613d3057565b613f8d90939293614102565b9263ffffffff9182855116908115613fda5790613fac92910690613f74565b835182166000190191808311613d3057613fc7921690613d46565b6040909201516001600160a01b03169190565b5050506040909201516001600160a01b03169150600090565b3d1561401e573d906140048261383f565b91614012604051938461381e565b82523d6000602084013e565b606090565b919061402e816138c5565b9061403c604051928361381e565b808252601f1961404b826138c5565b0160005b8181106140f1575050819360005b82811061406a5750505050565b8060051b820135601e1983360301811215610a21578201908135916001600160401b038311610a21576020809101908336038213610a21576000806140b66140d594600197369161385a565b6140be615502565b9381519101305af46140ce613ff3565b9030615c27565b6140df8287613eae565b526140ea8186613eae565b500161405d565b80606060208093870101520161404f565b6040805191614110836137cd565b60008084526020808501829052938301819052908152610160808452828220546001600160a01b0392919080851c84168061417a57505081805284528290208251939061415c856137cd565b549063ffffffff808316865282821c1690850152821c169082015290565b9493509491505081519361418d856137cd565b63ffffffff908181168652821c169084015282015290565b90916141bc6138ac936040845260408401906139a3565b9160208184039101526139a3565b600090815261012d60205260409020546001600160a01b03908116919082156141f05750565b60008080526040902054169150565b9092919261420c8161383f565b9161421a604051938461381e565b829482845282820111610a21576020613b9a930190613706565b602081830312610a21578051906001600160401b038211610a2157019080601f83011215610a215781516138ac926020016141ff565b6000805261012d6020527fa581b17bfc4d6578e300cafbf34fd2dc1fef0270d8c73f88a99dcde2859a6639546001600160a01b039081168015614302575b16806142b757506138ac613bfd565b60006004916040519283809263e8a3d48560e01b82525afa9081156142f6576000916142e1575090565b6138ac91503d806000833e613c7f818361381e565b6040513d6000823e3d90fd5b6142a8565b6001600160a01b03166000818152600080516020615d1d8339815191526020526040812054602216158015906101fe9061436b575b5015614346575050565b6064925060405191634baa2a4d60e01b83526004830152602482015260206044820152fd5b905081805260205260408120828252602052602260408220541615153861433c565b9060008181526101fe9081602052604081209360018060a01b031693848252602052601260408220541615918215926143f1575b5050156143cc575050565b6064925060405191634baa2a4d60e01b83526004830152602482015260106044820152fd5b6012925090604091818052602052818120858252602052205416151538806143c1565b6001600160a01b03166000818152600080516020615d1d8339815191526020526040812054600616158015906101fe90614478575b5015614453575050565b6064925060405191634baa2a4d60e01b83526004830152602482015260046044820152fd5b9050818052602052604081208282526020526006604082205416151538614449565b9060008181526101fe9081602052604081209360018060a01b031693848252602052600660408220541615918215926144d9575b505015614453575050565b6006925090604091818052602052818120858252602052205416151538806144ce565b6101ca9060018060a01b03166001600160601b0360a01b8254161790556001604051600080516020615cbd83398151915233918061453981613f2e565b0390a3565b6001600160a01b03166000818152600080516020615d1d8339815191526020526040812054600216158015906101fe906145a2575b501561457d575050565b6064925060405191634baa2a4d60e01b83526004830152602482015260026044820152fd5b9050818052602052604081208282526020526002604082205416151538614573565b9060008181526101fe9081602052604081209360018060a01b03169384825260205260026040822054161591821592614603575b50501561457d575050565b6002925090604091818052602052818120858252602052205416151538806145f8565b6101c980546001600160a01b039283166001600160a01b0319821681179092556040805193909116835260208301919091527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a16000604051600080516020615cbd83398151915233918061453981613f2e565b156146a257565b60405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608490fd5b156146ff57565b60405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b6064820152608490fd5b1561475957565b60405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b6064820152608490fd5b6002606554146147c2576002606555565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b95929491929091614821836001600160a01b03891661449a565b61484b847f0000000000000000000000000000000000000000000000000000000000000000613d1d565b9460009687968560005261023160205260018060a01b0360406000205416918215614ff3575b805115614fcb576001600160a01b039061488a90613e8b565b5116905b6001600160a01b03821615614fa3575b6148a787613ec2565b906001600160a01b03821615614f7b575b600088815261023260205260409020546001600160a01b03168015614f74575b60006148e2615bd8565b508234106000146148ff57604051633b78763760e21b8152600490fd5b348303614ea4575061490f615bd8565b50614918615bd8565b6302625a008082526020820162989680815260408301906301312d008252606084019160008352838702938785041487151715613d305761499a61499a926149a2956305f5e10080910488528061497083518c613d1d565b0482528061497f85518c613d1d565b04845261498d86518b613d1d565b0485528651905190613f74565b905190613f74565b8303838111613d30576080820152915b82519384614e9e57506000915b60208401516040850151606086015160809096015191959192907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163b15610a215760405163faa3516f60e01b81526001600160a01b039687166004820152602481019890985298851660448801526064870195909552958316608486015260a485019690965291811660c484015260e48301939093527f00000000000000000000000000000000000000000000000000000000000000008316610104830152610124820193909352916000918391610144918391907f0000000000000000000000000000000000000000000000000000000000000000165af180156142f657614e87575b508160c488926040519485938492636890e5b360e01b84523360048501528960248501528a60448501528b606485015260a060848501528160a4850152848401378181018301859052601f01601f19168101030181836001600160a01b038c165af1908115612eb2578691614ce5575b505192855b8451811015614c9d57614b548186613eae565b5151614b5f81613f0e565b614b6881613f0e565b60018103614bf857506020614b7d8287613eae565b510151604081805181010312612a45576040614b9b60208301615c13565b91015190818811614be65788918291829182916001600160a01b03166204baf0f1614bc4613ff3565b5015614bd4576001905b01614b41565b6040516338dcead760e21b8152600490fd5b604051631913cf3760e21b8152600490fd5b80614c04600292613f0e565b03614c95576020614c158287613eae565b51015190606082805181010312612a4557614c3260208301615c13565b916060604082015191015190868015159182614c8a575b5050614c7857600192614c73918760405192614c6484613803565b8c8452868060a01b031661592d565b614bce565b604051634cdcfbf960e01b8152600490fd5b141590508638614c49565b600190614bce565b506040805191825234602083015291969295506001600160a01b0390921693503392507fb362243af1e2070d7d5bf8d713f2e0fab64203f1b71462afbe20572909788c5e91a4565b3d91508187823e614cf6828261381e565b6020818381010312614e83578051906001600160401b038211612a455760408282018483010312612a455760405192614d2e846137e8565b828201516001600160401b038111614e7f57818301601f8286860101011215614e7f57808484010151614d60816138c5565b92614d6e604051948561381e565b818452602084019281860160208460051b838a8a0101010111614e7b576020818888010101935b60208460051b838a8a010101018510614dc257505050505090602092918452010151602082015238614b3c565b84516001600160401b038111614e77576040888a0184018201858a0103601f190112614e775760405190614df5826137e8565b602081858c8c01010101516003811015614e72578252604081858c8c0101010151906001600160401b038211614e7257858a018b8b01860182018301603f011215614e7257898b018501010160208181015190938493849391929091614e6191898e01916040016141ff565b838201528152019501949050614d95565b508f80fd5b8e80fd5b8c80fd5b8980fd5b8680fd5b60c49750614e9490613789565b8160009750614acc565b916149bf565b90919a50614eb0615bd8565b50614eb9615bd8565b908082528b6020830162989680815260408401906301c9c380825260016060860193858552151715614f6057614f3292918f61499a9261499a91878952614f256305f5e1009182614f0b855183613d1d565b04845282614f1a875183613d1d565b048652875190613d1d565b0485528751905190613f74565b8c03908c8211614f4c57506080820152908a34039a6149b2565b634e487b7160e01b81526011600452602490fd5b634e487b7160e01b84526011600452602484fd5b50816148d8565b7f000000000000000000000000000000000000000000000000000000000000000091506148b8565b7f0000000000000000000000000000000000000000000000000000000000000000915061489e565b507f00000000000000000000000000000000000000000000000000000000000000009061488e565b7f00000000000000000000000000000000000000000000000000000000000000009250614871565b6101c8805460018101909155604051959490939290615039876137b2565b828752816020880152600060408801528015156060880152846000526101c660205260406000209680519788516001600160401b03811161379c5761507e8254613b1e565b99601f8b116152cf575b88999a50600098979850602090601f83116001146152235794886151cd979561512f829686600080516020615c9d833981519152976020977f1b944478023872bf91b25a13fdba3a686fdb1bf4dbb872f850240fad4b8cc0689e9c600092615218575b50508160011b916000199060031b1c19161781555b8583015160018201556040830151600282015560036060840151151591019060ff801983541691151516179055565b7f323bc81dbd896aad1241aab7ac995a86244a273b7b4ac5263224b966cfd128356040518061515f339482613a5e565b0390a36040519015158152a260008581526101fe602090815260408083206001600160a01b03999099168084529890915281208054600217908190559087908790600080516020615cdd8339815191529080a481516151d9575b604051928392604084526040840190613729565b9060208301520390a390565b847f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b60405160208152806152106020820187613729565b0390a26151b9565b0151905038806150eb565b908360005260206000209160005b601f19851681106152b457506151cd979561512f8b966001876020977f1b944478023872bf91b25a13fdba3a686fdb1bf4dbb872f850240fad4b8cc0689e9c978b97600080516020615c9d8339815191529b601f1981161061529b575b505050811b018155615100565b015160001960f88460031b161c1916905538808061528e565b8183015184558c9a5060019093019260209283019201615231565b826000526020600020601f830160051c81016020841061530c575b601f8d0160051c82018110615300575050615088565b600081556001016152ea565b50806152ea565b1561531a57565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b9081516001600160401b03811161379c57610193906153928254613b1e565b601f8111615459575b50602080601f83116001146153d85750819293946000926153cd575b50508160011b916000199060031b1c1916179055565b0151905038806153b7565b90601f19831695846000527ffc8af01f449989052b52093a58fc9f42d0b11f0c6dd5dca0463dab62346ccc68926000905b88821061544157505083600195969710615428575b505050811b019055565b015160001960f88460031b161c1916905538808061541e565b80600185968294968601518155019501930190615409565b6000836000527ffc8af01f449989052b52093a58fc9f42d0b11f0c6dd5dca0463dab62346ccc68601f840160051c810192602085106154b5575b601f0160051c01915b8281106154aa57505061539b565b81815560010161549c565b9092508290615493565b6001600160a01b03166000818152600080516020615d1d833981519152602052604081208054600217908190559190600080516020615cdd8339815191528180a4565b6040519061550f826137cd565b60278252660819985a5b195960ca1b6040837f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208201520152565b6101cb5492946000946001600160a01b039485169291836155c7575b50505050505090815b81518110156155c2576155838183613eae565b5183526101c6602052604060ff6003828620015416806155bb575b6155ab5750600101615570565b51633518113960e01b8152600490fd5b508361559e565b505050565b833b15614e83578694939261563087938793604051998a9889978896634058856760e11b885230600489015216602487015286604487015216606485015260e060848501526122a961561d8d60e48701906139a3565b60031993848783030160a48801526139a3565b03925af18015611b2557615649575b8080808080615567565b61565290613789565b3861563f565b6101cb5460009692956001600160a01b039594918616939091846156cb575b5050505050835b81518110156156c4576156918183613eae565b5185526101c6602052604060ff6003828820015416806156b9575b6155ab575060010161567e565b5083851615156156ac565b5050505050565b843b1561574f57604051634058856760e11b8152306004820152938716602485015286881660448501528616606484015260e0608484015291928792849283918591839161572491906122a961561d60e486018d6139a3565b03925af1801561251d5761573c575b80808080615677565b61574890949194613789565b9238615733565b8880fd5b90816020910312610a2157516001600160e01b031981168103610a215790565b60809060208152602860208201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b60608201520190565b60009060033d116157c957565b905060046000803e60005160e01c90565b600060443d106138ac57604051600319913d83016004833e81516001600160401b03918282113d6024840111176158375781840194855193841161583f573d8501016020848701011161583757506138ac9291016020019061381e565b949350505050565b50949350505050565b60809060208152603460208201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356040820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b60608201520190565b803b156158d257600080516020615cfd83398151915280546001600160a01b0319166001600160a01b03909216919091179055565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b91926159398483615b02565b6000908282526020936101c6855260409560028785200161595b828254613f74565b90556001600160a01b03821691615973831515615b5d565b6159918461598088615bb3565b61598985615bb3565b90843361554b565b8585526097875287852083865287528785206159ae838254613f74565b905582858951888152848a8201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628b3392a43b6159f0575b50505050505050565b9185969795918493615a37958a5180978195829463f23a6e6160e01b9b8c85523360048601528560248601526044850152606484015260a0608484015260a4830190613729565b03925af1909181615ae3575b50615aaa57505050615a536157bc565b6308c379a014615a76575b505162461bcd60e51b8152806104b560048201615848565b615a7e6157da565b9081615a8a5750615a5e565b6104b5835192839262461bcd60e51b845260048401526024830190613729565b919392506001600160e01b031990911603615acc5750388080808080806159e7565b5162461bcd60e51b8152806104b560048201615773565b615afb919250853d871161054d5761053e818361381e565b9038615a43565b90816000526101c66020526040600020906002820154906001615b258284613f74565b930154809311615b355750505050565b6084945060405193631255c8fd60e01b85526004850152602484015260448301526064820152fd5b15615b6457565b60405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608490fd5b60405190615bc0826137e8565b6001825260203681840137615bd482613e8b565b5290565b6040519060a082018281106001600160401b0382111761379c5760405260006080838281528260208201528260408201528260608201520152565b51906001600160a01b0382168203610a2157565b91929015615c895750815115615c3b575090565b3b15615c445790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156130eb5750805190602001fdfed7266d744eff586b57e3bcc53ca2c87fa8be61a1938b5a680f1b72568415f5da3be6d3a1d957610f7e900c66889b874cdc9f0c22901aa8be6ec3d2d04c14ca0f35fb03d0d293ef5b362761900725ce891f8f766b5a662cdd445372355448e7ca360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5f4301e3e862ad13c0503d3de32ba4e2e40c90733d1da23c9df4d0addbcf6508a264697066735822122049d4dff293c39cca2da38a568ffb192947a420f0eb4701af9554468fa06e085d64736f6c6343000819003300000000000000000000000000000000000000000000000002c68af0bb14000000000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab05000000000000000000000000b626edb882a9276b333ffa1042321e5135b873e70000000000000000000000004d030e7d6fc1ea7ecead9d6d1e349c1e825c2f59

Deployed Bytecode

0x6080604052600436101561001b575b361561001957600080fd5b005b6000803560e01c8062fdd58e146136b2578063011442011461369657806301ffc9a7146135f557806306fdde031461350d5780630e89341c146134ed57806310a7eb5d146134c257806313966db514610bf057806313af40351461345a57806317bd48bb146133e957806318711c7d146133cd57806318e97fd11461322e57806323bd0386146131e05780632a55205a1461316a5780632eb2c2d614612ebd578063300ecdb914612bb55780633659cfe614612c605780633ccfd60b14612bfa5780634913162d14612bb55780634e1273f414612a6d5780634f1ef2861461279057806352d1902d146126cc5780635c60da1b146126965780635d0f6cba146125475780635e4e0404146125285780636661a9ba146123bb57806369a5b302146123875780636b20c4541461202d578063731133e914611fcf57806375794a3c14611fb057806379502c5514611f565780637dafae4d14611f225780637f2dc61c14611e405780637f77f57414611df057806384ac319114611d5f5780638621ea4b14611d1f5780638a08eb4c146117415780638c7a63ae146116b95780638da5cb5b1461168f5780638ec998a01461162f578063929a71281461161457806395d89b41146115b55780639993eae11461153e5780639c5c63c9146114a55780639ebb832414611471578063a0a8e4601461142b578063a22cb4651461133e578063a453eaf014611322578063a457c67314611300578063ac9650d814611268578063afed7e9e14611098578063bb3bafd614611040578063bf2435b914610fc2578063c046435614610fa6578063c238d1ee14610f08578063d1ad846b14610bf5578063d7bf81a314610bf0578063d904b94a14610a26578063da46243114610942578063dd15e05f1461090e578063e72878b4146108c8578063e74d86c214610897578063e8a3d48514610863578063e985e9c51461080f578063ef71c82e1461059e578063f1b0d6bb146105825763f242432a146102fc575061000e565b3461057f5760a036600319011261057f576103156136da565b9061031e6136f0565b9160443590606435906084356001600160401b03811161057b57610346903690600401613891565b9160018060a01b039361039284868516963388148015610554575b61036a90613d66565b8916946103788615156146f8565b61038184615bb3565b8a61038b87615bb3565b9233615658565b8086526020966097885260408720866000528852826040600020546103b982821015614752565b83895260978a5260408920886000528a5203604060002055818752609788526040872084600052885260406000206103f2848254613f74565b90558386604051848152858b8201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6260403392a43b610430578580f35b916104769391600088946040519687958694859363f23a6e6160e01b9b8c865233600487015260248601526044850152606484015260a0608484015260a4830190613729565b03925af160009181610525575b506104ee57836104916157bc565b6308c379a0146104b9575b60405162461bcd60e51b8152806104b560048201615848565b0390fd5b6104c16157da565b90816104cd575061049c565b6104b560405192839262461bcd60e51b845260048401526024830190613729565b9192506001600160e01b03199091160361050c578038808080808580f35b60405162461bcd60e51b8152806104b560048201615773565b610546919250853d871161054d575b61053e818361381e565b810190615753565b9038610483565b503d610534565b508789526098602052604089203360005260205261036a60ff604060002054169050610361565b8480fd5b80fd5b503461057f578060031936011261057f57602060405160048152f35b503461057f57604036600319011261057f576001600160401b0360043581811161080b576105d0903690600401613891565b602435828111610807576105e8903690600401613891565b336000908152600080516020615d1d833981519152602090815260409091205491939091601216158015906101fe906107e3575b50156107bd578480526101c68252604085209083519081116107a9576106428254613b1e565b601f8111610766575b5082601f82116001146106dd57927f74b7c2afa3f89c562b59674a101e2c48bceeb27cdb620afefa14446f1ffa487b9492826106cc936106bd968a916106d2575b508160011b916000199060031b1c19161790555b6106a986615373565b604051938493604085526040850190613729565b90838203908401523395613729565b0390a280f35b90508501513861068c565b82875283872090601f198316885b81811061074f5750836106bd96937f74b7c2afa3f89c562b59674a101e2c48bceeb27cdb620afefa14446f1ffa487b9896936106cc9660019410610736575b5050811b0190556106a0565b87015160001960f88460031b161c19169055388061072a565b91928660018192868b0151815501940192016106eb565b828752838720601f830160051c81019185841061079f575b601f0160051c01905b818110610794575061064b565b878155600101610787565b909150819061077e565b634e487b7160e01b86526041600452602486fd5b604051634baa2a4d60e01b81523360048201526000602482015260106044820152606490fd5b9050600080528252604060002033600052825260126040600020541615153861061c565b8380fd5b8280fd5b503461057f57604036600319011261057f576108296136da565b60406108336136f0565b9260018060a01b0380931681526098602052209116600052602052602060ff604060002054166040519015158152f35b503461057f578060031936011261057f5761089361087f61426a565b604051918291602083526020830190613729565b0390f35b503461057f57602036600319011261057f5760206108b66004356141ca565b6040516001600160a01b039091168152f35b503461057f57602036600319011261057f576004356000196101c854018181036108f0578280f35b6044925060405191634fa09b3f60e01b835260048301526024820152fd5b503461057f57602036600319011261057f57602090600435815261012d8252604060018060a01b0391205416604051908152f35b503461057f57604036600319011261057f5760043580151590818103610a215760243591826000526101fe91602092808452604060002033600052845260026040600020541615908115916109fd575b50156109d757906109cd600080516020615c9d83398151915293928587526101c68452600360408820019060ff801983541691151516179055565b604051908152a280f35b604051634baa2a4d60e01b81523360048201526024810185905260026044820152606490fd5b90506000805283526040600020336000528352600260406000205416151538610992565b600080fd5b503461057f57606036600319011261057f57600435610a436136f0565b906044356001600160401b03811161080757610a63903690600401613a31565b91806000526101fe936020948086526040600020336000528652600a604060002054161590811591610bcc575b5015610ba6576001600160a01b031690610aaa818361449a565b6040516301ffc9a760e01b8152636890e5b360e01b60048201528581602481865afa908115610b9b578791610b6e575b5015610b555783602411610b5157600483013503610b3f57828580949381946040519384928337810182815203925af190610b13613ff3565b9115610b1d578280f35b6104b560405192839263a5fa8d2b60e01b845260048401526024830190613729565b60405163fe486c2b60e01b8152600490fd5b8580fd5b6040516370adc70360e11b815260048101839052602490fd5b610b8e9150863d8811610b94575b610b86818361381e565b810190613ef6565b38610ada565b503d610b7c565b6040513d89823e3d90fd5b604051634baa2a4d60e01b81523360048201526024810183905260086044820152606490fd5b90506000805285526040600020336000528552600a60406000205416151538610a90565b61374e565b503461057f57600319608036820112610f0457610c106136da565b6001600160401b0392602435848111610f0457610c3190369060040161392a565b9160443585811161080b57610c4a90369060040161392a565b9460643590811161080b57610c63903690600401613891565b93610c6c6147b1565b8280526020926101fe8452604081203360005284526006604060002054161596815b8651811015610cbf5760019089610ca6575b01610c8e565b610cba610cb3828a613eae565b513361449a565b610ca0565b5086959394958451835b818110610eab5750506001600160a01b03861693610ce8851515615b5d565b610cf5865184511461469b565b610d028284888a3361554b565b835b8651811015610d4e5780610d1a60019286613eae565b51610d25828a613eae565b51875260978b5260408720886000528b52610d466040600020918254613f74565b905501610d04565b50879695939585876040517f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb339180610d888a8c836141a5565b0390a43b610dd1575b5050610dc67fc0d6da87a629809c1b871e1d2d54452fae1988bf4e85d2c82f51246281b6173c916040519182913395836141a5565b0390a3600160655580f35b86610e2c916040518093819263bc197c8160e01b968784523360048501526000602485015260a06044850152610e1d610e0d60a486018c6139a3565b838682030160648701528a6139a3565b91848303016084850152613729565b03816000895af160009181610e8c575b50610e4a57866104916157bc565b9091929394955063ffffffff60e01b160361050c5783929190610dc67fc0d6da87a629809c1b871e1d2d54452fae1988bf4e85d2c82f51246281b6173c610d91565b610ea4919250883d8a1161054d5761053e818361381e565b9088610e3c565b80610ecd610ebb6001938a613eae565b51610ec68388613eae565b5190615b02565b610ed78186613eae565b51610ee2828a613eae565b5187526101c68b52610efc60026040892001918254613f74565b905501610cc9565b5080fd5b503461057f57608036600319011261057f57610f226136da565b60243590604435906064356001600160401b03811161057b57610f4c610f66913690600401613891565b610f546147b1565b610f5e853361449a565b83858461592d565b6040519182526001600160a01b03169033907f78dab3a57c593d7cff5047cf6f6eedd10503cf2958b842f3eb39b363d457a4db90602090a4600160655580f35b503461057f578060031936011261057f57602060405160028152f35b5060a036600319011261057f57610fd76136da565b6001600160401b039060643582811161080757610ff8903690600401613a01565b909160843593841161057b5761102a611018611038953690600401613a31565b9490936110236147b1565b3691613945565b906044359060243590614807565b600160655580f35b503461057f57602036600319011261057f57610893611060600435614102565b60408051825163ffffffff908116825260208085015190911690820152918101516001600160a01b0316908201529081906060820190565b503461057f57608036600319011261057f576004356060366023190112610a2157604051906110c6826137cd565b63ffffffff6024358181168103610a215783526044358181168103610a21576020848101918252606435906001600160a01b038083168303610a215760408701928352856000526101fe80835260406000203360005283526022604060002054161590811591611244575b50156112205784875116611217575b825116158061120b575b6111f95784600052610160815267ffffffff000000006040600020948751169185549451901b169168010000000000000000600160e01b03905160401b169263ffffffff60e01b1617171790557f5837d55897cfc337f160a71d7b63a047abd50a3a8834f1c5d70f338846358c6d604051806111f33395829190916040606082019363ffffffff80825116845260208201511660208401528160018060a01b0391015116910152565b0390a380f35b604051630d9b92f160e01b8152600490fd5b5083835116151561114a565b60008752611140565b6064868360405191634baa2a4d60e01b835233600484015260248301526044820152fd5b90506000805282526040600020336000528252602260406000205416151538611131565b503461057f57602080600319360112610f04576004356001600160401b03811161080b576112a461129e84923690600401613a01565b90614023565b60405191838301848452825180915260408401948060408360051b870101940192955b8287106112d45785850386f35b9091929382806112f0600193603f198a82030186528851613729565b96019201960195929190926112c7565b503461057f57602061131a611314366138af565b90613d1d565b604051908152f35b503461057f578060031936011261057f57602060405160108152f35b503461057f57604036600319011261057f576113586136da565b6024359081151590818303610a21576001600160a01b0316913383146113d4576113a5903385526098602052604085208460005260205260406000209060ff801983541691151516179055565b6040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b60405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608490fd5b503461057f578060031936011261057f5761089360405161144b816137e8565b6005815264322e302e3160d81b6020820152604051918291602083526020830190613729565b503461057f57602036600319011261057f5760209060043581526102328252604060018060a01b0391205416604051908152f35b503461057f57604036600319011261057f57806024356004356001600160401b03821161153a576114db83923690600401613891565b906114e6813361438d565b6001600160a01b03906114f8906141ca565b1682602083519301915af161150b613ff3565b9015611515575080f35b60405163a5fa8d2b60e01b8152602060048201529081906104b5906024830190613729565b5050fd5b503461057f57606036600319011261057f576004356001600160401b038111610f045761156f903690600401613a31565b6044358015158103610a21576020926115a89261158b33614414565b6115936147b1565b6115a3339260243592369161385a565b61501b565b6001606555604051908152f35b503461057f578060031936011261057f576040516020808252816060519182602083015260005b8381106115fe5750508160006040809484010152601f80199101168101030190f35b60808101518582016040015284925081016115dc565b503461057f578060031936011261057f576020604051818152f35b503461057f5761163e366139d7565b9161164981336145c4565b60008181526101fe602090815260408083206001600160a01b039590951680845294909152812080549490941793849055600080516020615cdd8339815191529080a480f35b503461057f578060031936011261057f576101c9546040516001600160a01b039091168152602090f35b503461057f57602036600319011261057f5760408161089392606083516116df816137b2565b8181528260208201528285820152015260043581526101c66020522060ff60036040519261170c846137b2565b61171581613b58565b845260018101546020850152600281015460408501520154161515606082015260405191829182613a5e565b503461057f5760e036600319011261057f576004356001600160401b038111610f0457611772903690600401613891565b906024356001600160401b038111610f0457611792903690600401613891565b916060366043190112610f04576040516117ab816137cd565b60443563ffffffff8116810361080757815260643563ffffffff811681036108075760208201526084356001600160a01b038116810361080757604082015260a4356001600160a01b038116900361080b5760c4356001600160401b0381116108075761181c903690600401613a01565b9190926118276147b1565b84549560ff8760081c161596878098611d12575b8015611cfb575b15611c9f5760ff198116600117875587611c8e575b5061187a60ff875460081c1661186c81615313565b61187581615313565b615313565b600160655561189360a4356001600160a01b03166154bf565b6101c890815491600183019055604051906118ad826137b2565b81528660208201528660408201528660608201528187526101c66020526040872081518051906001600160401b038211611c7a579082916118f086959454613b1e565b601f8111611c26575b50602090601f8311600114611bb85761195b9392918c9183611bad575b50508160011b916000199060031b1c19161781555b602083015160018201556040830151600282015560036060840151151591019060ff801983541691151516179055565b7f323bc81dbd896aad1241aab7ac995a86244a273b7b4ac5263224b966cfd128356040518061198b339482613a5e565b0390a3600080516020615c9d8339815191526020604051888152a263ffffffff825116611ba5575b60408201516001600160a01b03161580611b92575b6111f9578480526101606020908152604080872084518154868501805197850180516001600160e01b031990931663ffffffff94851690811799881b67ffffffff00000000169990991792861b68010000000000000000600160e01b03169290921790935583519687529151169285019290925290516001600160a01b031690830152611a9d91339086907f5837d55897cfc337f160a71d7b63a047abd50a3a8834f1c5d70f338846358c6d90606090a3611a8d60a4356001600160a01b0316614626565b611a9860a4356144fc565b615373565b80611b30575b505060653b1561057f5760405163388a0bbd60e11b815281816004818360655af18015611b2557611b16575b5090611add57600160655580f35b61ff001981541681557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a1611038565b611b1f90613789565b38611acf565b6040513d84823e3d90fd5b611b4291611b3d336154bf565b614023565b508080526101fe806020526040822033835260205260021960408320541690828052602052604082203383526020528060408320553382600080516020615cdd8339815191528180a43880611aa3565b5063ffffffff60208301511615156119c8565b8482526119b3565b015190503880611916565b90838c5260208c20918c5b601f1985168110611c0b575091839160019361195b9695601f19811610611bf2575b505050811b01815561192b565b015160001960f88460031b161c19169055388080611be5565b81830151845588975060019093019260209283019201611bc3565b909192809495508b5260208b20601f840160051c810160208510611c73575b90879695949392915b8d601f840160051c83018210611c66575050506118f9565b8155889750600101611c4e565b5080611c45565b634e487b7160e01b8a52604160045260248afd5b61ffff191661010117865538611857565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b1580156118425750600160ff821614611842565b50600160ff82161061183b565b503461057f57606036600319011261057f57611d42604435602435600435613f81565b604080516001600160a01b03939093168352602083019190915290f35b503461057f57608036600319011261057f576004356001600160401b038111610f0457611d90903690600401613a31565b91906044356001600160a01b038116919082900361080b5760643593841515850361080757602094604092611dc89261158b33614414565b8084526102318552922080546001600160a01b03191690911790556001606555604051908152f35b503461057f57602036600319011261057f5760406060916004358152610160602052205463ffffffff906040519180821683528160201c16602083015260018060a01b039060401c166040820152f35b503461057f57602036600319011261057f576004356001600160a01b03811690819003610f0457611e703361453e565b80611eab575b6101cb906001600160601b0360a01b8254161790556002604051600080516020615cbd8339815191523391806111f381613f2e565b6040516301ffc9a760e01b8152634058856760e11b6004820152602081602481855afa908115611f17578391611ef8575b50611e76576024906040519062be74ab60e51b82526004820152fd5b611f11915060203d602011610b9457610b86818361381e565b38611edc565b6040513d85823e3d90fd5b503461057f57602036600319011261057f5760209060043581526102318252604060018060a01b0391205416604051908152f35b503461057f578060031936011261057f5760c06101c95460018060a01b036101ca54906101cb549160405193828116855260a01c6020850152818116604085015260a01c60608401528116608083015260a01c60a0820152f35b503461057f578060031936011261057f5760206101c854604051908152f35b50608036600319011261057f57611fe46136da565b606435906001600160401b03821161080b57612007611038923690600401613a31565b916120106147b1565b6040519061201d82613803565b8582526044359060243590614807565b503461057f57600319606036820112610f04576120486136da565b602491602435936001600160401b0394858111610f045761206d903690600401613a01565b9490936044966044359081116108075761208b903690600401613a01565b9560018060a01b0397888416933385141580612366575b61233d57506120bf92916120b79136916138dc565b9636916138dc565b9381156122ec576120d3865186511461469b565b604051906120e082613803565b84825284976101cb54169182612245575b505050855b8551811015612149576121098187613eae565b5187526101c660205260ff60036040892001541680612141575b61212f576001016120f6565b604051633518113960e01b8152600490fd5b506001612123565b5086949394835b85518110156121fd576121638187613eae565b5161216e8289613eae565b5190808752609760209080825260408920878a5282526040892054928484106121af57895281526040808920878a5290915287209190039055600101612150565b6084837f455243313135353a206275726e20616d6f756e7420657863656564732062616c898c6040519362461bcd60e51b855260048501528084015282015263616e636560e01b6064820152fd5b848084887f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb6122348c6040519182913395836141a5565b0390a4612242604051613803565b80f35b823b15610b515786928887866122b88296612299966122a96040519a8b998a988997634058856760e11b89523060048a01523360248a0152604489015288606489015260e0608489015260e48801906139a3565b90848783030160a48801526139a3565b918483030160c4850152613729565b03925af180156122e1576122ce575b80806120f1565b6122d9919650613789565b8194386122c7565b6040513d86823e3d90fd5b60405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b6040516341ce11f960e11b81523360048201526001600160a01b03919091166024820152604490fd5b5084875260986020526040872033885260205260ff604088205416156120a2565b503461057f57602036600319011261057f5760209060043581526101c78252604060018060a01b0391205416604051908152f35b503461057f57604036600319011261057f576004356024356001600160a01b0381169081900361080b576123ed6147b1565b6123f7823361438d565b81835261012d60209081526040842080546001600160a01b0319168317905590806124b3575b6040513382857f5010f780a0de79bcfb9f3d6fec3cfe29758ef5c5800d575af709bc590bd78ade8880a484846124815750507f56e810c8cae84731149f628981d25769a084570b9ba6eebf3c32879e3dce56099250604051908152a1600160655580f35b60409250837f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b948352820152a2611038565b6040516301ffc9a760e01b8152633de3f32360e11b60048201528281602481855afa90811561251d578591612500575b5061241d576024906040519063da755beb60e01b82526004820152fd5b6125179150833d8511610b9457610b86818361381e565b386124e3565b6040513d87823e3d90fd5b503461057f57602036600319011261057f5760206108b6600435613ec2565b503461057f5780612557366139d7565b916001600160a01b0391821633811480612674575b15612665575b8185526101fe9160209483865260408720838852865260408720549019168187528386526040872083885286528060408820558282600080516020615cdd8339815191528980a4159182612656575b82612635575b50506125d1575050f35b7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0926040926101c9928354936001600160601b0360a01b85169055845193168352820152a180604051600080516020615cbd8339815191523391806111f381613f2e565b909150848052835260408420908452825260026040842054161538806125c7565b6101c9548416821492506125c1565b61266f82336145c4565b612572565b508185526101fe6020526040852033865260205283806040872054161461256c565b503461057f578060031936011261057f57600080516020615cfd833981519152546040516001600160a01b039091168152602090f35b503461057f578060031936011261057f577f000000000000000000000000606e9f439f0294b6443f6e250aaa60daabc7d3716001600160a01b03163003612725576020604051600080516020615cfd8339815191528152f35b60405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608490fd5b50604036600319011261057f576127a56136da565b6024356001600160401b03811161080b576127c582913690600401613891565b6001600160a01b037f000000000000000000000000606e9f439f0294b6443f6e250aaa60daabc7d3718116906127fd30831415613dc9565b600080516020615cfd8339815191529161281c82845416918214613e2a565b6128253361453e565b6040516321f7434760e01b81526001600160a01b0391821660048201529516602486015260209485816044817f000000000000000000000000b626edb882a9276b333ffa1042321e5135b873e786165afa908115610b9b578791612a50575b5015610b51577f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156128c157505050612242915061589d565b83929316906040516352d1902d60e01b81528581600481865afa879181612a1d575b506129445760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b949394036129c6576129558261589d565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8580a2838351158015906129be575b612991575b5050505080f35b806129b49461299e615502565b9481519101845af46129ae613ff3565b91615c27565b503880808361298a565b506001612985565b60405162461bcd60e51b815260048101849052602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608490fd5b9091508681813d8311612a49575b612a35818361381e565b81010312612a45575190386128e3565b8780fd5b503d612a2b565b612a679150863d8811610b9457610b86818361381e565b38612884565b503461057f57604036600319011261057f576001600160401b0360043581811161080b573660238201121561080b57612ab0903690602481600401359101613945565b9060243590811161080b57612ac990369060040161392a565b8151815103612b5e57815192612ade846138c5565b93612aec604051958661381e565b808552612afb601f19916138c5565b013660208601375b8251811015612b4857600190612b376001600160a01b03612b248387613eae565b5116612b308386613eae565b5190613a99565b612b418287613eae565b5201612b03565b60405160208082528190610893908201876139a3565b60405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608490fd5b503461057f57604036600319011261057f576040602091612bd46136f0565b60043582526101fe84528282206001600160a01b03909116825283522054604051908152f35b503461057f578060031936011261057f57612c1433614307565b4760018060a01b036101ca8380808086868654166204baf0f1612c35613ff3565b5015612c3f578380f35b604493505416906040519163292264c360e21b835260048301526024820152fd5b503461057f57602080600319360112610f0457612c7b6136da565b6001600160a01b037f000000000000000000000000606e9f439f0294b6443f6e250aaa60daabc7d3718116612cb230821415613dc9565b612d0f8484600080516020615cfd83398151915293612cd686865416918214613e2a565b612cdf3361453e565b6040516321f7434760e01b81526001600160a01b0391821660048201529116602482015291829081906044820190565b0381867f000000000000000000000000b626edb882a9276b333ffa1042321e5135b873e7165afa908115612eb2578691612e95575b501561057b5760405191612d5783613803565b8583527f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612d9157505050612242915061589d565b83929316906040516352d1902d60e01b81528581600481865afa879181612e66575b50612e145760405162461bcd60e51b815260048101879052602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608490fd5b949394036129c657612e258261589d565b7fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8580a283835115801590612e5f57612991575050505080f35b5080612985565b9091508681813d8311612e8e575b612e7e818361381e565b81010312612a4557519038612db3565b503d612e74565b612eac9150853d8711610b9457610b86818361381e565b38612d44565b6040513d88823e3d90fd5b503461057f5760031960a036820112610f0457612ed86136da565b90612ee16136f0565b9183604435926001600160401b039384811161080b57612f0590369060040161392a565b9060643585811161080757612f1e90369060040161392a565b9460843590811161080757612f37903690600401613891565b90612f7f8287858a60018060a01b03612f5e818c169a338c14908115613149575b50613d66565b612f6b835185511461469b565b811699612f798b15156146f8565b33615658565b875b888451821015613006575080612f9960019286613eae565b51612fa4828a613eae565b5190808c5260976020918183528d8a60408220915283528d60408581832054612fcf82821015614752565b8484528587528d8385209085528752039120558d52815260408c2090898d5252612ffe60408c20918254613f74565b905501612f81565b959050869186898388887f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb604051806130418b3395836141a5565b0390a43b61304c5780f35b610e1d9561309c61308c93602097604051998a988997889663bc197c8160e01b9e8f89523360048a0152602489015260a0604489015260a48801906139a3565b90848783030160648801526139a3565b03925af1839181613128575b5061310f576130b56157bc565b6308c379a0146130d85760405162461bcd60e51b8152806104b560048201615848565b6130e06157da565b806130eb575061049c565b60405162461bcd60e51b8152602060048201529081906104b5906024830190613729565b6001600160e01b0319160361050c578180808080808680f35b61314291925060203d60201161054d5761053e818361381e565b90846130a8565b60ff9150808d6040925260986020528181203382526020522054168f612f58565b503461057f576131896131c161319a613182366138af565b9390614102565b9263ffffffff602085015116613d1d565b7f000000000000000000000000000000000000000000000000000000000000271090613d46565b60409182015182516001600160a01b0390911681526020810191909152f35b503461057f57606036600319011261057f576020906131fd6136da565b60243582526101fe8352604082209060018060a01b0316825282526040604435600217912054161515604051908152f35b503461057f57604036600319011261057f576001600160401b039060043560243583811161080b57613264903690600401613891565b9261326f823361438d565b811561080b5760405191807f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b602094858152806132ae8782018a613729565b0390a283526101c68252604083209184519182116133b9576132d08354613b1e565b601f8111613376575b5080601f83116001146133145750839482939492613309575b50508160011b916000199060031b1c191617905580f35b0151905038806132f2565b90601f198316958486528286209286905b88821061335e57505083600195969710613345575b505050811b01905580f35b015160001960f88460031b161c1916905538808061333a565b80600185968294968601518155019501930190613325565b838552818520601f840160051c8101918385106133af575b601f0160051c01905b8181106133a457506132d9565b858155600101613397565b909150819061338e565b634e487b7160e01b84526041600452602484fd5b503461057f578060031936011261057f57602060405160088152f35b503461057f57604036600319011261057f576004356134066136f0565b8183526102316020819052604084205491926001600160a01b0392831633036134485784526020526040832091166001600160601b0360a01b82541617905580f35b604051632afb0ecf60e01b8152600490fd5b503461057f57602036600319011261057f576134746136da565b61347d3361453e565b8180526101fe602090815260408084206001600160a01b0384168552909152822054600216156134b05761224290614626565b60405163131dd3a760e31b8152600490fd5b503461057f57602036600319011261057f576122426134df6136da565b6134e833614307565b6144fc565b503461057f57602036600319011261057f5761089361087f600435613cab565b503461057f578060031936011261057f5760405190808261019392835461353381613b1e565b93848452602095600192876001821691826000146135d1575050600114613578575b5050506135649250038361381e565b610893604051928284938452830190613729565b8152859250907ffc8af01f449989052b52093a58fc9f42d0b11f0c6dd5dca0463dab62346ccc685b8583106135b95750506135649350820101388080613555565b805483890185015287945086939092019181016135a0565b93509450505061356494915060ff191682840152151560051b820101388080613555565b503461057f57602036600319011261057f5760043563ffffffff60e01b8116809103610f045760209063152a902d60e11b8114908115613685575b8115613642575b506040519015158152f35b636cdb3d1360e11b811491508115613674575b8115613663575b5082613637565b6301ffc9a760e01b1490508261365c565b6303a24d0760e21b81149150613655565b63023a443960e31b81149150613630565b503461057f578060031936011261057f57602090604051908152f35b503461057f57604036600319011261057f57602061131a6136d16136da565b60243590613a99565b600435906001600160a01b0382168203610a2157565b602435906001600160a01b0382168203610a2157565b60005b8381106137195750506000910152565b8181015183820152602001613709565b9060209161374281518092818552858086019101613706565b601f01601f1916010190565b34610a21576000366003190112610a215760206040517f00000000000000000000000000000000000000000000000002c68af0bb1400008152f35b6001600160401b03811161379c57604052565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b0382111761379c57604052565b606081019081106001600160401b0382111761379c57604052565b604081019081106001600160401b0382111761379c57604052565b602081019081106001600160401b0382111761379c57604052565b90601f801991011681019081106001600160401b0382111761379c57604052565b6001600160401b03811161379c57601f01601f191660200190565b9291926138668261383f565b91613874604051938461381e565b829481845281830111610a21578281602093846000960137010152565b9080601f83011215610a21578160206138ac9335910161385a565b90565b6040906003190112610a21576004359060243590565b6001600160401b03811161379c5760051b60200190565b92916138e7826138c5565b916138f5604051938461381e565b829481845260208094019160051b8101928311610a2157905b82821061391b5750505050565b8135815290830190830161390e565b9080601f83011215610a21578160206138ac933591016138dc565b9291613950826138c5565b9161395e604051938461381e565b829481845260208094019160051b8101928311610a2157905b8282106139845750505050565b81356001600160a01b0381168103610a21578152908301908301613977565b90815180825260208080930193019160005b8281106139c3575050505090565b8351855293810193928101926001016139b5565b6060906003190112610a2157600435906024356001600160a01b0381168103610a21579060443590565b9181601f84011215610a21578235916001600160401b038311610a21576020808501948460051b010111610a2157565b9181601f84011215610a21578235916001600160401b038311610a215760208381860195010111610a2157565b6020815260806060613a7b845183602086015260a0850190613729565b93602081015160408501526040810151828501520151151591015290565b6001600160a01b0316908115613ac657600052609760205260406000209060005260205260406000205490565b60405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b6064820152608490fd5b90600182811c92168015613b4e575b6020831014613b3857565b634e487b7160e01b600052602260045260246000fd5b91607f1691613b2d565b90604051918260008254613b6b81613b1e565b90818452602094600191600181169081600014613bdb5750600114613b9c575b505050613b9a9250038361381e565b565b600090815285812095935091905b818310613bc3575050613b9a9350820101388080613b8b565b85548884018501529485019487945091830191613baa565b92505050613b9a94925060ff191682840152151560051b820101388080613b8b565b60008080526101c680602052613c166040832054613b1e565b613c98575080805261012d60205260408120546001600160a01b0390829082168015613c93575b6024604051809481936303a24d0760e21b8352856004840152165afa918215613c87578092613c6b57505090565b6138ac92503d8091833e613c7f818361381e565b810190614234565b604051903d90823e3d90fd5b613c3d565b81604091816138ac945260205220613b58565b6000908082526101c680602052613cc56040842054613b1e565b613d0a5750816001600160a01b03613cdc836141ca565b16916024604051809481936303a24d0760e21b835260048301525afa918215613c87578092613c6b57505090565b916138ac92604092825260205220613b58565b81810292918115918404141715613d3057565b634e487b7160e01b600052601160045260246000fd5b8115613d50570490565b634e487b7160e01b600052601260045260246000fd5b15613d6d57565b60405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b6064820152608490fd5b15613dd057565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b19195b1959d85d1958d85b1b60a21b6064820152608490fd5b15613e3157565b60405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201526b6163746976652070726f787960a01b6064820152608490fd5b805115613e985760200190565b634e487b7160e01b600052603260045260246000fd5b8051821015613e985760209160051b010190565b6001600160a01b03908190604090613ed990614102565b01511680613ef157506101ca5416806138ac57503090565b905090565b90816020910312610a2157518015158103610a215790565b60031115613f1857565b634e487b7160e01b600052602160045260246000fd5b6101c9546001600160a01b03808216835260a091821c60208401526101ca548082166040850152821c60608401526101cb549081166080840152811c9082015260c00190565b91908201809211613d3057565b613f8d90939293614102565b9263ffffffff9182855116908115613fda5790613fac92910690613f74565b835182166000190191808311613d3057613fc7921690613d46565b6040909201516001600160a01b03169190565b5050506040909201516001600160a01b03169150600090565b3d1561401e573d906140048261383f565b91614012604051938461381e565b82523d6000602084013e565b606090565b919061402e816138c5565b9061403c604051928361381e565b808252601f1961404b826138c5565b0160005b8181106140f1575050819360005b82811061406a5750505050565b8060051b820135601e1983360301811215610a21578201908135916001600160401b038311610a21576020809101908336038213610a21576000806140b66140d594600197369161385a565b6140be615502565b9381519101305af46140ce613ff3565b9030615c27565b6140df8287613eae565b526140ea8186613eae565b500161405d565b80606060208093870101520161404f565b6040805191614110836137cd565b60008084526020808501829052938301819052908152610160808452828220546001600160a01b0392919080851c84168061417a57505081805284528290208251939061415c856137cd565b549063ffffffff808316865282821c1690850152821c169082015290565b9493509491505081519361418d856137cd565b63ffffffff908181168652821c169084015282015290565b90916141bc6138ac936040845260408401906139a3565b9160208184039101526139a3565b600090815261012d60205260409020546001600160a01b03908116919082156141f05750565b60008080526040902054169150565b9092919261420c8161383f565b9161421a604051938461381e565b829482845282820111610a21576020613b9a930190613706565b602081830312610a21578051906001600160401b038211610a2157019080601f83011215610a215781516138ac926020016141ff565b6000805261012d6020527fa581b17bfc4d6578e300cafbf34fd2dc1fef0270d8c73f88a99dcde2859a6639546001600160a01b039081168015614302575b16806142b757506138ac613bfd565b60006004916040519283809263e8a3d48560e01b82525afa9081156142f6576000916142e1575090565b6138ac91503d806000833e613c7f818361381e565b6040513d6000823e3d90fd5b6142a8565b6001600160a01b03166000818152600080516020615d1d8339815191526020526040812054602216158015906101fe9061436b575b5015614346575050565b6064925060405191634baa2a4d60e01b83526004830152602482015260206044820152fd5b905081805260205260408120828252602052602260408220541615153861433c565b9060008181526101fe9081602052604081209360018060a01b031693848252602052601260408220541615918215926143f1575b5050156143cc575050565b6064925060405191634baa2a4d60e01b83526004830152602482015260106044820152fd5b6012925090604091818052602052818120858252602052205416151538806143c1565b6001600160a01b03166000818152600080516020615d1d8339815191526020526040812054600616158015906101fe90614478575b5015614453575050565b6064925060405191634baa2a4d60e01b83526004830152602482015260046044820152fd5b9050818052602052604081208282526020526006604082205416151538614449565b9060008181526101fe9081602052604081209360018060a01b031693848252602052600660408220541615918215926144d9575b505015614453575050565b6006925090604091818052602052818120858252602052205416151538806144ce565b6101ca9060018060a01b03166001600160601b0360a01b8254161790556001604051600080516020615cbd83398151915233918061453981613f2e565b0390a3565b6001600160a01b03166000818152600080516020615d1d8339815191526020526040812054600216158015906101fe906145a2575b501561457d575050565b6064925060405191634baa2a4d60e01b83526004830152602482015260026044820152fd5b9050818052602052604081208282526020526002604082205416151538614573565b9060008181526101fe9081602052604081209360018060a01b03169384825260205260026040822054161591821592614603575b50501561457d575050565b6002925090604091818052602052818120858252602052205416151538806145f8565b6101c980546001600160a01b039283166001600160a01b0319821681179092556040805193909116835260208301919091527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a16000604051600080516020615cbd83398151915233918061453981613f2e565b156146a257565b60405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608490fd5b156146ff57565b60405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b6064820152608490fd5b1561475957565b60405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b6064820152608490fd5b6002606554146147c2576002606555565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b95929491929091614821836001600160a01b03891661449a565b61484b847f00000000000000000000000000000000000000000000000002c68af0bb140000613d1d565b9460009687968560005261023160205260018060a01b0360406000205416918215614ff3575b805115614fcb576001600160a01b039061488a90613e8b565b5116905b6001600160a01b03821615614fa3575b6148a787613ec2565b906001600160a01b03821615614f7b575b600088815261023260205260409020546001600160a01b03168015614f74575b60006148e2615bd8565b508234106000146148ff57604051633b78763760e21b8152600490fd5b348303614ea4575061490f615bd8565b50614918615bd8565b6302625a008082526020820162989680815260408301906301312d008252606084019160008352838702938785041487151715613d305761499a61499a926149a2956305f5e10080910488528061497083518c613d1d565b0482528061497f85518c613d1d565b04845261498d86518b613d1d565b0485528651905190613f74565b905190613f74565b8303838111613d30576080820152915b82519384614e9e57506000915b60208401516040850151606086015160809096015191959192907f0000000000000000000000004d030e7d6fc1ea7ecead9d6d1e349c1e825c2f596001600160a01b03163b15610a215760405163faa3516f60e01b81526001600160a01b039687166004820152602481019890985298851660448801526064870195909552958316608486015260a485019690965291811660c484015260e48301939093527f00000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab058316610104830152610124820193909352916000918391610144918391907f0000000000000000000000004d030e7d6fc1ea7ecead9d6d1e349c1e825c2f59165af180156142f657614e87575b508160c488926040519485938492636890e5b360e01b84523360048501528960248501528a60448501528b606485015260a060848501528160a4850152848401378181018301859052601f01601f19168101030181836001600160a01b038c165af1908115612eb2578691614ce5575b505192855b8451811015614c9d57614b548186613eae565b5151614b5f81613f0e565b614b6881613f0e565b60018103614bf857506020614b7d8287613eae565b510151604081805181010312612a45576040614b9b60208301615c13565b91015190818811614be65788918291829182916001600160a01b03166204baf0f1614bc4613ff3565b5015614bd4576001905b01614b41565b6040516338dcead760e21b8152600490fd5b604051631913cf3760e21b8152600490fd5b80614c04600292613f0e565b03614c95576020614c158287613eae565b51015190606082805181010312612a4557614c3260208301615c13565b916060604082015191015190868015159182614c8a575b5050614c7857600192614c73918760405192614c6484613803565b8c8452868060a01b031661592d565b614bce565b604051634cdcfbf960e01b8152600490fd5b141590508638614c49565b600190614bce565b506040805191825234602083015291969295506001600160a01b0390921693503392507fb362243af1e2070d7d5bf8d713f2e0fab64203f1b71462afbe20572909788c5e91a4565b3d91508187823e614cf6828261381e565b6020818381010312614e83578051906001600160401b038211612a455760408282018483010312612a455760405192614d2e846137e8565b828201516001600160401b038111614e7f57818301601f8286860101011215614e7f57808484010151614d60816138c5565b92614d6e604051948561381e565b818452602084019281860160208460051b838a8a0101010111614e7b576020818888010101935b60208460051b838a8a010101018510614dc257505050505090602092918452010151602082015238614b3c565b84516001600160401b038111614e77576040888a0184018201858a0103601f190112614e775760405190614df5826137e8565b602081858c8c01010101516003811015614e72578252604081858c8c0101010151906001600160401b038211614e7257858a018b8b01860182018301603f011215614e7257898b018501010160208181015190938493849391929091614e6191898e01916040016141ff565b838201528152019501949050614d95565b508f80fd5b8e80fd5b8c80fd5b8980fd5b8680fd5b60c49750614e9490613789565b8160009750614acc565b916149bf565b90919a50614eb0615bd8565b50614eb9615bd8565b908082528b6020830162989680815260408401906301c9c380825260016060860193858552151715614f6057614f3292918f61499a9261499a91878952614f256305f5e1009182614f0b855183613d1d565b04845282614f1a875183613d1d565b048652875190613d1d565b0485528751905190613f74565b8c03908c8211614f4c57506080820152908a34039a6149b2565b634e487b7160e01b81526011600452602490fd5b634e487b7160e01b84526011600452602484fd5b50816148d8565b7f00000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab0591506148b8565b7f00000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab05915061489e565b507f00000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab059061488e565b7f00000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab059250614871565b6101c8805460018101909155604051959490939290615039876137b2565b828752816020880152600060408801528015156060880152846000526101c660205260406000209680519788516001600160401b03811161379c5761507e8254613b1e565b99601f8b116152cf575b88999a50600098979850602090601f83116001146152235794886151cd979561512f829686600080516020615c9d833981519152976020977f1b944478023872bf91b25a13fdba3a686fdb1bf4dbb872f850240fad4b8cc0689e9c600092615218575b50508160011b916000199060031b1c19161781555b8583015160018201556040830151600282015560036060840151151591019060ff801983541691151516179055565b7f323bc81dbd896aad1241aab7ac995a86244a273b7b4ac5263224b966cfd128356040518061515f339482613a5e565b0390a36040519015158152a260008581526101fe602090815260408083206001600160a01b03999099168084529890915281208054600217908190559087908790600080516020615cdd8339815191529080a481516151d9575b604051928392604084526040840190613729565b9060208301520390a390565b847f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b60405160208152806152106020820187613729565b0390a26151b9565b0151905038806150eb565b908360005260206000209160005b601f19851681106152b457506151cd979561512f8b966001876020977f1b944478023872bf91b25a13fdba3a686fdb1bf4dbb872f850240fad4b8cc0689e9c978b97600080516020615c9d8339815191529b601f1981161061529b575b505050811b018155615100565b015160001960f88460031b161c1916905538808061528e565b8183015184558c9a5060019093019260209283019201615231565b826000526020600020601f830160051c81016020841061530c575b601f8d0160051c82018110615300575050615088565b600081556001016152ea565b50806152ea565b1561531a57565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b9081516001600160401b03811161379c57610193906153928254613b1e565b601f8111615459575b50602080601f83116001146153d85750819293946000926153cd575b50508160011b916000199060031b1c1916179055565b0151905038806153b7565b90601f19831695846000527ffc8af01f449989052b52093a58fc9f42d0b11f0c6dd5dca0463dab62346ccc68926000905b88821061544157505083600195969710615428575b505050811b019055565b015160001960f88460031b161c1916905538808061541e565b80600185968294968601518155019501930190615409565b6000836000527ffc8af01f449989052b52093a58fc9f42d0b11f0c6dd5dca0463dab62346ccc68601f840160051c810192602085106154b5575b601f0160051c01915b8281106154aa57505061539b565b81815560010161549c565b9092508290615493565b6001600160a01b03166000818152600080516020615d1d833981519152602052604081208054600217908190559190600080516020615cdd8339815191528180a4565b6040519061550f826137cd565b60278252660819985a5b195960ca1b6040837f416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c60208201520152565b6101cb5492946000946001600160a01b039485169291836155c7575b50505050505090815b81518110156155c2576155838183613eae565b5183526101c6602052604060ff6003828620015416806155bb575b6155ab5750600101615570565b51633518113960e01b8152600490fd5b508361559e565b505050565b833b15614e83578694939261563087938793604051998a9889978896634058856760e11b885230600489015216602487015286604487015216606485015260e060848501526122a961561d8d60e48701906139a3565b60031993848783030160a48801526139a3565b03925af18015611b2557615649575b8080808080615567565b61565290613789565b3861563f565b6101cb5460009692956001600160a01b039594918616939091846156cb575b5050505050835b81518110156156c4576156918183613eae565b5185526101c6602052604060ff6003828820015416806156b9575b6155ab575060010161567e565b5083851615156156ac565b5050505050565b843b1561574f57604051634058856760e11b8152306004820152938716602485015286881660448501528616606484015260e0608484015291928792849283918591839161572491906122a961561d60e486018d6139a3565b03925af1801561251d5761573c575b80808080615677565b61574890949194613789565b9238615733565b8880fd5b90816020910312610a2157516001600160e01b031981168103610a215790565b60809060208152602860208201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b60608201520190565b60009060033d116157c957565b905060046000803e60005160e01c90565b600060443d106138ac57604051600319913d83016004833e81516001600160401b03918282113d6024840111176158375781840194855193841161583f573d8501016020848701011161583757506138ac9291016020019061381e565b949350505050565b50949350505050565b60809060208152603460208201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356040820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b60608201520190565b803b156158d257600080516020615cfd83398151915280546001600160a01b0319166001600160a01b03909216919091179055565b60405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608490fd5b91926159398483615b02565b6000908282526020936101c6855260409560028785200161595b828254613f74565b90556001600160a01b03821691615973831515615b5d565b6159918461598088615bb3565b61598985615bb3565b90843361554b565b8585526097875287852083865287528785206159ae838254613f74565b905582858951888152848a8201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628b3392a43b6159f0575b50505050505050565b9185969795918493615a37958a5180978195829463f23a6e6160e01b9b8c85523360048601528560248601526044850152606484015260a0608484015260a4830190613729565b03925af1909181615ae3575b50615aaa57505050615a536157bc565b6308c379a014615a76575b505162461bcd60e51b8152806104b560048201615848565b615a7e6157da565b9081615a8a5750615a5e565b6104b5835192839262461bcd60e51b845260048401526024830190613729565b919392506001600160e01b031990911603615acc5750388080808080806159e7565b5162461bcd60e51b8152806104b560048201615773565b615afb919250853d871161054d5761053e818361381e565b9038615a43565b90816000526101c66020526040600020906002820154906001615b258284613f74565b930154809311615b355750505050565b6084945060405193631255c8fd60e01b85526004850152602484015260448301526064820152fd5b15615b6457565b60405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608490fd5b60405190615bc0826137e8565b6001825260203681840137615bd482613e8b565b5290565b6040519060a082018281106001600160401b0382111761379c5760405260006080838281528260208201528260408201528260608201520152565b51906001600160a01b0382168203610a2157565b91929015615c895750815115615c3b575090565b3b15615c445790565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606490fd5b8251909150156130eb5750805190602001fdfed7266d744eff586b57e3bcc53ca2c87fa8be61a1938b5a680f1b72568415f5da3be6d3a1d957610f7e900c66889b874cdc9f0c22901aa8be6ec3d2d04c14ca0f35fb03d0d293ef5b362761900725ce891f8f766b5a662cdd445372355448e7ca360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5f4301e3e862ad13c0503d3de32ba4e2e40c90733d1da23c9df4d0addbcf6508a264697066735822122049d4dff293c39cca2da38a568ffb192947a420f0eb4701af9554468fa06e085d64736f6c63430008190033

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

00000000000000000000000000000000000000000000000002c68af0bb14000000000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab05000000000000000000000000b626edb882a9276b333ffa1042321e5135b873e70000000000000000000000004d030e7d6fc1ea7ecead9d6d1e349c1e825c2f59

-----Decoded View---------------
Arg [0] : _mintFeeAmount (uint256): 200000000000000000
Arg [1] : _mintFeeRecipient (address): 0x26C8Ca628F088D11F37C66C9F87ac0Fa87edaB05
Arg [2] : _factory (address): 0xb626edb882a9276b333fFa1042321e5135B873E7
Arg [3] : _protocolRewards (address): 0x4D030e7D6Fc1Ea7ecead9D6D1e349c1E825C2f59

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000002c68af0bb140000
Arg [1] : 00000000000000000000000026c8ca628f088d11f37c66c9f87ac0fa87edab05
Arg [2] : 000000000000000000000000b626edb882a9276b333ffa1042321e5135b873e7
Arg [3] : 0000000000000000000000004d030e7d6fc1ea7ecead9d6d1e349c1e825c2f59


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.