ETH Price: $3,120.73 (-5.21%)
Gas: 5 Gwei

Contract

0xB253B0c006b68c3A5A7906fdfd380aeB90ABEa4D
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value

There are no matching entries

Please try again later

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To Value
191694122024-02-06 13:11:23149 days ago1707225083  Contract Creation0 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x16fcED9c...1384689F7
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Worlds

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 1337000 runs

Other Settings:
shanghai EvmVersion
File 1 of 53 : Worlds.sol
/*
  ・
   * ★
      ・ 。
         ・ ゚☆ 。
      * ★ ゚・。 *  。
            * ☆ 。・゚*.。
         ゚ *.。☆。★ ・
​
                      `                     .-:::::-.`              `-::---...```
                     `-:`               .:+ssssoooo++//:.`       .-/+shhhhhhhhhhhhhyyyssooo:
                    .--::.            .+ossso+/////++/:://-`   .////+shhhhhhhhhhhhhhhhhhhhhy
                  `-----::.         `/+////+++///+++/:--:/+/-  -////+shhhhhhhhhhhhhhhhhhhhhy
                 `------:::-`      `//-.``.-/+ooosso+:-.-/oso- -////+shhhhhhhhhhhhhhhhhhhhhy
                .--------:::-`     :+:.`  .-/osyyyyyyso++syhyo.-////+shhhhhhhhhhhhhhhhhhhhhy
              `-----------:::-.    +o+:-.-:/oyhhhhhhdhhhhhdddy:-////+shhhhhhhhhhhhhhhhhhhhhy
             .------------::::--  `oys+/::/+shhhhhhhdddddddddy/-////+shhhhhhhhhhhhhhhhhhhhhy
            .--------------:::::-` +ys+////+yhhhhhhhddddddddhy:-////+yhhhhhhhhhhhhhhhhhhhhhy
          `----------------::::::-`.ss+/:::+oyhhhhhhhhhhhhhhho`-////+shhhhhhhhhhhhhhhhhhhhhy
         .------------------:::::::.-so//::/+osyyyhhhhhhhhhys` -////+shhhhhhhhhhhhhhhhhhhhhy
       `.-------------------::/:::::..+o+////+oosssyyyyyyys+`  .////+shhhhhhhhhhhhhhhhhhhhhy
       .--------------------::/:::.`   -+o++++++oooosssss/.     `-//+shhhhhhhhhhhhhhhhhhhhyo
     .-------   ``````.......--`        `-/+ooooosso+/-`          `./++++///:::--...``hhhhyo
                                              `````
   * 
      ・ 。
    ・  ゚☆ 。
      * ★ ゚・。 *  。
            * ☆ 。・゚*.。
         ゚ *.。☆。★ ・
    *  ゚。·*・。 ゚*
     ☆゚・。°*. ゚
  ・ ゚*。・゚★。
  ・ *゚。   *
 ・゚*。★・
 ☆∴。 *
・ 。
*/

// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { ContextUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import { ERC165Upgradeable } from "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";
import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";

import { IERC165Upgradeable } from "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol";
import { IWorldsDropMarket } from "./interfaces/internal/IWorldsDropMarket.sol";
import { IWorldsNFTMarket } from "./interfaces/internal/IWorldsNFTMarket.sol";
import { IWorldsSharedMarket } from "./interfaces/internal/IWorldsSharedMarket.sol";
import { IWorldsNftUserRoles } from "./interfaces/internal/routes/IWorldsNftUserRoles.sol";

import { DelegateForwarder } from "./mixins/shared/DelegateForwarder.sol";
import { ERC4906 } from "./mixins/collections/ERC4906.sol";
import { ERC721UserRoles } from "./mixins/roles/ERC721UserRoles.sol";
import { RouterContextDouble } from "./mixins/shared/RouterContextDouble.sol";

import { EIP712 } from "./mixins/worlds/EIP712.sol";
import { WorldsAllowlist } from "./mixins/worlds/WorldsAllowlist.sol";
import { WorldsAllowlistBySeller } from "./mixins/worlds/WorldsAllowlistBySeller.sol";
import { WorldsAllowlistBySignature } from "./mixins/worlds/WorldsAllowlistBySignature.sol";
import { WorldsCore } from "./mixins/worlds/WorldsCore.sol";
import { WorldsInventoryByCollection } from "./mixins/worlds/WorldsInventoryByCollection.sol";
import { WorldsInventoryByNft } from "./mixins/worlds/WorldsInventoryByNft.sol";
import { WorldsInventoryBySplit } from "./mixins/worlds/WorldsInventoryBySplit.sol";
import { WorldsManagement } from "./mixins/worlds/WorldsManagement.sol";
import { WorldsMetadata } from "./mixins/worlds/WorldsMetadata.sol";
import { WorldsNotImplemented } from "./mixins/worlds/WorldsNotImplemented.sol";
import { WorldsPaymentInfo } from "./mixins/worlds/WorldsPaymentInfo.sol";
import { WorldsTransfer2Step } from "./mixins/worlds/WorldsTransfer2Step.sol";
import { WorldsUserRoles } from "./mixins/worlds/WorldsUserRoles.sol";

/**
 * @title Worlds are NFTs which aggregate collections of curated content.
 * @author HardlyDifficult & reggieag
 */
contract Worlds is
  IWorldsDropMarket,
  IWorldsNFTMarket,
  DelegateForwarder,
  IWorldsSharedMarket,
  IWorldsNftUserRoles,
  Initializable,
  ContextUpgradeable,
  ERC165Upgradeable,
  RouterContextDouble,
  ERC721Upgradeable,
  ERC4906,
  ERC721UserRoles,
  WorldsCore,
  WorldsUserRoles,
  WorldsMetadata,
  WorldsPaymentInfo,
  WorldsAllowlistBySeller,
  WorldsAllowlistBySignature,
  WorldsAllowlist,
  WorldsInventoryByCollection,
  WorldsInventoryBySplit,
  WorldsInventoryByNft,
  WorldsManagement,
  WorldsTransfer2Step,
  WorldsNotImplemented
{
  ////////////////////////////////////////////////////////////////
  // Setup
  ////////////////////////////////////////////////////////////////

  /**
   * @dev Required in order to avoid stack to deep errors.
   * @param worldsProxyAddress The proxy contract which will delegate to this implementation.
   * @param routerContext1 An address with permission to override the default _msgSender().
   * @param routerContext2 An address with permission to override the default _msgSender().
   * @param splitTemplate The contract which will be used to create new World split proxies.
   * @param trustedSigner The address which is allowed to sign for Worlds.
   * @param maxWorldId The maximum World id that can be minted on this network.
   */
  struct WorldsConstructorParams {
    address worldsProxyAddress;
    address routerContext1;
    address routerContext2;
    address splitTemplate;
    address trustedSigner;
    uint256 maxWorldId;
  }

  /**
   * @notice Set immutable variables for the implementation contract.
   * @param constructorParams The immutable variable configuration.
   * @param worldsMetadataDelegate The contract which will handle some metadata requests for Worlds.
   * @dev Using immutable instead of constants allows us to use different values on testnet.
   */
  constructor(
    WorldsConstructorParams memory constructorParams,
    address worldsMetadataDelegate
  )
    RouterContextDouble(constructorParams.routerContext1, constructorParams.routerContext2)
    WorldsMetadata(worldsMetadataDelegate)
    WorldsInventoryBySplit(constructorParams.splitTemplate)
    EIP712("Worlds", "1", constructorParams.worldsProxyAddress)
    WorldsAllowlistBySignature(constructorParams.trustedSigner)
    WorldsManagement(constructorParams.maxWorldId)
  {
    _disableInitializers();
  }

  /**
   * @notice Initialize the upgradeable proxy contract for Worlds.
   * @param networkWorldIdOffset The first world minted on this network will use `worldId = networkWorldIdOffset + 1`.
   */
  function initialize(uint256 networkWorldIdOffset) external reinitializer(2) {
    // Assign the NFT's name and symbol.
    __ERC721_init_unchained("Worlds", "WORLD");
    _initializeWorldsManagement(networkWorldIdOffset);
  }

  ////////////////////////////////////////////////////////////////
  // Inheritance Requirements
  // (no-ops to avoid compile errors)
  ////////////////////////////////////////////////////////////////

  /// @inheritdoc IERC165Upgradeable
  function supportsInterface(
    bytes4 interfaceId
  )
    public
    view
    override(ERC165Upgradeable, ERC721Upgradeable, ERC4906, WorldsMetadata, WorldsManagement)
    returns (bool isSupported)
  {
    isSupported = super.supportsInterface(interfaceId);
  }

  /// @inheritdoc WorldsMetadata
  function tokenURI(
    uint256 worldId
  ) public view override(ERC721Upgradeable, WorldsMetadata, WorldsManagement) returns (string memory uri) {
    uri = super.tokenURI(worldId);
  }

  /// @inheritdoc ERC721Upgradeable
  function _afterTokenTransfer(
    address from,
    address to,
    uint256 firstTokenId,
    uint256 batchSize
  ) internal override(ERC721Upgradeable, WorldsTransfer2Step) {
    super._afterTokenTransfer(from, to, firstTokenId, batchSize);
  }

  /// @inheritdoc ERC721Upgradeable
  function _burn(
    uint256 worldId
  ) internal override(ERC721Upgradeable, WorldsPaymentInfo, WorldsMetadata, WorldsAllowlistBySeller, WorldsManagement) {
    super._burn(worldId);
  }

  /// @inheritdoc ContextUpgradeable
  function _msgSender() internal view override(ContextUpgradeable, RouterContextDouble) returns (address sender) {
    sender = super._msgSender();
  }

  /// @inheritdoc WorldsNotImplemented
  function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId,
    bytes memory data
  ) public pure override(ERC721Upgradeable, WorldsNotImplemented) {
    super.safeTransferFrom(from, to, tokenId, data);
  }

  /// @inheritdoc WorldsNotImplemented
  function transferFrom(
    address from,
    address to,
    uint256 tokenId
  ) public pure override(ERC721Upgradeable, WorldsNotImplemented) {
    super.transferFrom(from, to, tokenId);
  }
}

File 2 of 53 : 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 3 of 53 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

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

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

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC721_init_unchained(name_, symbol_);
    }

    function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
        return
            interfaceId == type(IERC721Upgradeable).interfaceId ||
            interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _ownerOf(tokenId);
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

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

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

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

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

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

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721Upgradeable.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner or approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _ownerOf(tokenId) != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721Upgradeable.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId, 1);

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId, 1);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721Upgradeable.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId, 1);

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721Upgradeable.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId, 1);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal virtual {
        require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @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, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
     * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
     * that `ownerOf(tokenId)` is `a`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function __unsafe_increaseBalance(address account, uint256 amount) internal {
        _balances[account] += amount;
    }

    /**
     * @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[44] private __gap;
}

File 4 of 53 : IERC721MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 5 of 53 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 6 of 53 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

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

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

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

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

File 7 of 53 : 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 8 of 53 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;
import {Initializable} from "../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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @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 53 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import {Initializable} from "../../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 10 of 53 : 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 11 of 53 : 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 12 of 53 : SignedMathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMathUpgradeable {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 13 of 53 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";
import "./math/SignedMathUpgradeable.sol";

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

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

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value))));
    }

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

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

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 14 of 53 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.20;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

File 15 of 53 : Clones.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Clones.sol)

pragma solidity ^0.8.20;

/**
 * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
 * deploying minimal proxy contracts, also known as "clones".
 *
 * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
 * > a minimal bytecode implementation that delegates all calls to a known, fixed address.
 *
 * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
 * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
 * deterministic method.
 */
library Clones {
    /**
     * @dev A clone instance deployment failed.
     */
    error ERC1167FailedCreateClone();

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create opcode, which should never revert.
     */
    function clone(address implementation) internal returns (address instance) {
        /// @solidity memory-safe-assembly
        assembly {
            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
            // of the `implementation` address with the bytecode before the address.
            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
            instance := create(0, 0x09, 0x37)
        }
        if (instance == address(0)) {
            revert ERC1167FailedCreateClone();
        }
    }

    /**
     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
     *
     * This function uses the create2 opcode and a `salt` to deterministically deploy
     * the clone. Using the same `implementation` and `salt` multiple time will revert, since
     * the clones cannot be deployed twice at the same address.
     */
    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
        /// @solidity memory-safe-assembly
        assembly {
            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
            // of the `implementation` address with the bytecode before the address.
            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
            instance := create2(0, 0x09, 0x37, salt)
        }
        if (instance == address(0)) {
            revert ERC1167FailedCreateClone();
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt,
        address deployer
    ) internal pure returns (address predicted) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(add(ptr, 0x38), deployer)
            mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)
            mstore(add(ptr, 0x14), implementation)
            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)
            mstore(add(ptr, 0x58), salt)
            mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))
            predicted := keccak256(add(ptr, 0x43), 0x55)
        }
    }

    /**
     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
     */
    function predictDeterministicAddress(
        address implementation,
        bytes32 salt
    ) internal view returns (address predicted) {
        return predictDeterministicAddress(implementation, salt, address(this));
    }
}

File 16 of 53 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS
    }

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
     * and a bytes32 providing additional information about the error.
     *
     * If no error is returned, then the address can be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError, bytes32) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS, s);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature, bytes32(0));
        }

        return (signer, RecoverError.NoError, bytes32(0));
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}

File 17 of 53 : MessageHashUtils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
 *
 * The library provides methods for generating a hash of a message that conforms to the
 * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
 * specifications.
 */
library MessageHashUtils {
    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing a bytes32 `messageHash` with
     * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
     * keccak256, although any bytes32 value can be safely used because the final digest will
     * be re-hashed.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash
            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
        }
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing an arbitrary `message` with
     * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
        return
            keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x00` (data with intended validator).
     *
     * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
     * `validator` address. Then hashing the result.
     *
     * See {ECDSA-recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(hex"19_00", validator, data));
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
     *
     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
     * `\x19\x01` and hashing the result. It corresponds to the hash signed by the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
     *
     * See {ECDSA-recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, hex"19_01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            digest := keccak256(ptr, 0x42)
        }
    }
}

File 18 of 53 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @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 towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (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 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                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.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 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.

            uint256 twos = denominator & (0 - denominator);
            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 (unsignedRoundsUp(rounding) && 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
     * towards zero.
     *
     * 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 19 of 53 : SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.20;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeCast {
    /**
     * @dev Value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);

    /**
     * @dev An int value doesn't fit in an uint of `bits` size.
     */
    error SafeCastOverflowedIntToUint(int256 value);

    /**
     * @dev Value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedIntDowncast(uint8 bits, int256 value);

    /**
     * @dev An uint value doesn't fit in an int of `bits` size.
     */
    error SafeCastOverflowedUintToInt(uint256 value);

    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        if (value > type(uint248).max) {
            revert SafeCastOverflowedUintDowncast(248, value);
        }
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        if (value > type(uint240).max) {
            revert SafeCastOverflowedUintDowncast(240, value);
        }
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        if (value > type(uint232).max) {
            revert SafeCastOverflowedUintDowncast(232, value);
        }
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        if (value > type(uint224).max) {
            revert SafeCastOverflowedUintDowncast(224, value);
        }
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        if (value > type(uint216).max) {
            revert SafeCastOverflowedUintDowncast(216, value);
        }
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        if (value > type(uint208).max) {
            revert SafeCastOverflowedUintDowncast(208, value);
        }
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        if (value > type(uint200).max) {
            revert SafeCastOverflowedUintDowncast(200, value);
        }
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        if (value > type(uint192).max) {
            revert SafeCastOverflowedUintDowncast(192, value);
        }
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        if (value > type(uint184).max) {
            revert SafeCastOverflowedUintDowncast(184, value);
        }
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        if (value > type(uint176).max) {
            revert SafeCastOverflowedUintDowncast(176, value);
        }
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        if (value > type(uint168).max) {
            revert SafeCastOverflowedUintDowncast(168, value);
        }
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        if (value > type(uint160).max) {
            revert SafeCastOverflowedUintDowncast(160, value);
        }
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        if (value > type(uint152).max) {
            revert SafeCastOverflowedUintDowncast(152, value);
        }
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        if (value > type(uint144).max) {
            revert SafeCastOverflowedUintDowncast(144, value);
        }
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        if (value > type(uint136).max) {
            revert SafeCastOverflowedUintDowncast(136, value);
        }
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        if (value > type(uint128).max) {
            revert SafeCastOverflowedUintDowncast(128, value);
        }
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        if (value > type(uint120).max) {
            revert SafeCastOverflowedUintDowncast(120, value);
        }
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        if (value > type(uint112).max) {
            revert SafeCastOverflowedUintDowncast(112, value);
        }
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        if (value > type(uint104).max) {
            revert SafeCastOverflowedUintDowncast(104, value);
        }
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        if (value > type(uint96).max) {
            revert SafeCastOverflowedUintDowncast(96, value);
        }
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        if (value > type(uint88).max) {
            revert SafeCastOverflowedUintDowncast(88, value);
        }
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        if (value > type(uint80).max) {
            revert SafeCastOverflowedUintDowncast(80, value);
        }
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        if (value > type(uint72).max) {
            revert SafeCastOverflowedUintDowncast(72, value);
        }
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        if (value > type(uint64).max) {
            revert SafeCastOverflowedUintDowncast(64, value);
        }
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        if (value > type(uint56).max) {
            revert SafeCastOverflowedUintDowncast(56, value);
        }
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        if (value > type(uint48).max) {
            revert SafeCastOverflowedUintDowncast(48, value);
        }
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        if (value > type(uint40).max) {
            revert SafeCastOverflowedUintDowncast(40, value);
        }
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        if (value > type(uint32).max) {
            revert SafeCastOverflowedUintDowncast(32, value);
        }
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        if (value > type(uint24).max) {
            revert SafeCastOverflowedUintDowncast(24, value);
        }
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        if (value > type(uint16).max) {
            revert SafeCastOverflowedUintDowncast(16, value);
        }
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        if (value > type(uint8).max) {
            revert SafeCastOverflowedUintDowncast(8, value);
        }
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        if (value < 0) {
            revert SafeCastOverflowedIntToUint(value);
        }
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(248, value);
        }
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(240, value);
        }
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(232, value);
        }
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(224, value);
        }
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(216, value);
        }
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(208, value);
        }
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(200, value);
        }
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(192, value);
        }
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(184, value);
        }
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(176, value);
        }
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(168, value);
        }
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(160, value);
        }
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(152, value);
        }
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(144, value);
        }
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(136, value);
        }
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(128, value);
        }
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(120, value);
        }
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(112, value);
        }
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(104, value);
        }
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(96, value);
        }
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(88, value);
        }
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(80, value);
        }
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(72, value);
        }
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(64, value);
        }
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(56, value);
        }
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(48, value);
        }
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(40, value);
        }
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(32, value);
        }
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(24, value);
        }
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(16, value);
        }
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        if (downcasted != value) {
            revert SafeCastOverflowedIntDowncast(8, value);
        }
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        if (value > uint256(type(int256).max)) {
            revert SafeCastOverflowedUintToInt(value);
        }
        return int256(value);
    }
}

File 20 of 53 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 21 of 53 : ShortStrings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.20;

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

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using
     * {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}

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

pragma solidity ^0.8.20;

/**
 * @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(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 */
library StorageSlot {
    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 23 of 53 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

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

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

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

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

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

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

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 24 of 53 : IDelegateView.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

/**
 * @title Declares a function used to delegatecall in a read-only context.
 * @author HardlyDifficult
 */
interface IDelegateView {
  function _delegateView() external view;
}

File 25 of 53 : IWorldsDropMarket.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

interface IWorldsDropMarket {
  function soldInWorldByCollection(
    address seller,
    address nftContract,
    uint256 count,
    uint256 totalSalePrice
  ) external returns (uint256 worldId, address payable worldPaymentAddress, uint16 takeRateInBasisPoints);
}

File 26 of 53 : IWorldsInventoryBySplit.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

interface IWorldsInventoryBySplit {
  function soldInWorldBySplit(
    address market,
    uint256 value
  ) external returns (address payable worldPaymentAddress, uint256 curatorTakeInWei);

  function soldInWorldBySplitWorldPaymentFailed(address market, uint256 valueInWei) external;
}

File 27 of 53 : IWorldsNFTMarket.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

interface IWorldsNFTMarket {
  ////////////////////////////////////////////////////////////////
  // NFT specific
  ////////////////////////////////////////////////////////////////

  function soldInWorldByNft(
    address seller,
    address nftContract,
    uint256 nftTokenId,
    address buyer,
    uint256 salePrice
  ) external returns (uint256 worldId, address payable worldPaymentAddress, uint16 takeRateInBasisPoints);
}

File 28 of 53 : IWorldSplit.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

interface IWorldSplit {
  function initialize(address payable ownerAndAssetRecipient) external;
}

File 29 of 53 : IWorldsSharedMarket.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

interface IWorldsSharedMarket {
  error WorldsInventoryByNft_Not_In_A_World();

  function getDefaultTakeRate(uint256 worldId) external view returns (uint16 defaultTakeRateInBasisPoints);

  function addToWorldByCollectionV2(
    uint256 worldId,
    address nftContract,
    uint16 takeRateInBasisPoints,
    bytes calldata approvalData
  ) external;

  function addToWorldByNftV2(
    uint256 worldId,
    address nftContract,
    uint256 nftTokenId,
    uint16 takeRateInBasisPoints,
    bytes calldata approvalData
  ) external;

  function removeFromWorldByNft(address nftContract, uint256 nftTokenId) external;

  function getAssociationByCollection(
    address nftContract,
    address seller
  ) external view returns (uint256 worldId, uint16 takeRateInBasisPoints);

  function getAssociationByNft(
    address nftContract,
    uint256 nftTokenId,
    address seller
  ) external view returns (uint256 worldId, uint16 takeRateInBasisPoints);

  function getPaymentAddress(uint256 worldId) external view returns (address payable worldPaymentAddress);
}

File 30 of 53 : IWorldsNftUserRoles.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { UserRoleAction } from "../../../mixins/worlds/WorldsSharedTypes.sol";

interface IWorldsNftUserRoles {
  function manageRolesForUsers(uint256 worldId, UserRoleAction[] calldata userRoleActions) external;
}

File 31 of 53 : IOwnable.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

/// From https://eips.ethereum.org/EIPS/eip-173

/// @title ERC-173 Contract Ownership Standard
///  Note: the ERC-165 identifier for this interface is 0x7f5828d0
interface IOwnable {
  /// @notice Get the address of the owner
  /// @return The address of the owner.
  function owner() external view returns (address);

  /// @notice Set the address of the new owner of the contract
  /// @dev Set _newOwner to address(0) to renounce any ownership.
  /// @param _newOwner The address of the new owner of the contract
  function transferOwnership(address _newOwner) external;
}

File 32 of 53 : RouteCallLibrary.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

error RouteCallLibrary_Call_Failed_Without_Revert_Reason();

/**
 * @title A library for calling external contracts with an address appended to the calldata.
 * @author HardlyDifficult
 */
library RouteCallLibrary {
  /**
   * @notice Routes a call to the specified contract, appending the from address to the end of the calldata.
   * If the call reverts, this will revert the transaction and the original reason is bubbled up.
   * @param from The address to use as the msg sender when calling the contract.
   * @param to The contract address to call.
   * @param callData The call data to use when calling the contract, without the sender appended.
   */
  function routeCallTo(address from, address to, bytes memory callData) internal returns (bytes memory returnData) {
    // Forward the call, with the packed from address appended, to the specified contract.
    bool success;
    (success, returnData) = tryRouteCallTo(from, to, callData);

    // If the call failed, bubble up the revert reason.
    if (!success) {
      revertWithError(returnData);
    }
  }

  /**
   * @notice Routes a call to the specified contract, appending the from address to the end of the calldata.
   * This will not revert even if the external call fails.
   * @param from The address to use as the msg sender when calling the contract.
   * @param to The contract address to call.
   * @param callData The call data to use when calling the contract, without the sender appended.
   * @dev Consumers should look for positive confirmation that if the transaction is not successful, the returned revert
   * reason is expected as an acceptable reason to ignore. Generically ignoring reverts will lead to out-of-gas errors
   * being ignored and result in unexpected behavior.
   */
  function tryRouteCallTo(
    address from,
    address to,
    bytes memory callData
  ) internal returns (bool success, bytes memory returnData) {
    // Forward the call, with the packed from address appended, to the specified contract.
    // solhint-disable-next-line avoid-low-level-calls
    (success, returnData) = to.call(abi.encodePacked(callData, from));
  }

  /**
   * @notice Bubbles up the original revert reason of a low-level call failure where possible.
   * @dev Copied from OZ's `Address.sol` library, with a minor modification to the final revert scenario.
   * This should only be used when a low-level call fails.
   */
  function revertWithError(bytes memory returnData) internal 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 RouteCallLibrary_Call_Failed_Without_Revert_Reason();
    }
  }

  /**
   * @notice Extracts the appended sender address from the calldata.
   * @dev This uses the last 20 bytes of the calldata, with no guarantees that an address has indeed been appended.
   * If this is used for a call that was not routed with `routeCallTo`, the address returned will be incorrect (and
   * may be address(0)).
   */
  function extractAppendedSenderAddress() internal pure returns (address sender) {
    assembly {
      // The router appends the msg.sender to the end of the calldata
      // source: https://github.com/opengsn/gsn/blob/v3.0.0-beta.3/packages/contracts/src/ERC2771Recipient.sol#L48
      sender := shr(96, calldataload(sub(calldatasize(), 20)))
    }
  }
}

File 33 of 53 : TimeLibrary.sol
// SPDX-License-Identifier: MIT OR Apache-2.0

pragma solidity ^0.8.18;

/**
 * @title Helpers for working with time.
 * @author batu-inal & HardlyDifficult
 */
library TimeLibrary {
  /**
   * @notice Checks if the given timestamp is in the past.
   * @dev This helper ensures a consistent interpretation of expiry across the codebase.
   * This is different than `hasBeenReached` in that it will return false if the expiry is now.
   */
  function hasExpired(uint256 expiry) internal view returns (bool) {
    return expiry < block.timestamp;
  }

  /**
   * @notice Checks if the given timestamp is now or in the past.
   * @dev This helper ensures a consistent interpretation of expiry across the codebase.
   * This is different from `hasExpired` in that it will return true if the timestamp is now.
   */
  function hasBeenReached(uint256 timestamp) internal view returns (bool) {
    return timestamp <= block.timestamp;
  }
}

File 34 of 53 : ERC4906.sol
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.18;

import "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol";

/**
 * @title ERC-4906: Metadata Update Events.
 * @dev See https://eips.ethereum.org/EIPS/eip-4906
 */
contract ERC4906 is ERC165Upgradeable {
  /**
   * @notice This event emits when the metadata of a token is changed. So that the third-party platforms such as an NFT
   * market could timely update the images and related attributes of the NFT.
   * @param tokenId The ID of the NFT whose metadata is changed.
   */
  event MetadataUpdate(uint256 tokenId);

  /**
   * @notice This event emits when the metadata of a range of tokens is changed. So that the third-party platforms such
   * as an NFT market could timely update the images and related attributes of the NFTs.
   * @param fromTokenId The ID of the first NFT whose metadata is changed.
   * @param toTokenId The ID of the last NFT whose metadata is changed.
   */
  event BatchMetadataUpdate(uint256 fromTokenId, uint256 toTokenId);

  function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool isSupported) {
    // 0x49064906 is a magic number based on the EIP number.
    isSupported = interfaceId == bytes4(0x49064906) || super.supportsInterface(interfaceId);
  }
}

File 35 of 53 : ERC721UserRoles.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

/**
 * @title Defines storage and access of users roles for individual ERC721 tokens.
 * @author reggieag & HardlyDifficult
 */
abstract contract ERC721UserRoles {
  /// @notice Stores user roles per-token as a bitfield. Consumers should define the significance of each bit,
  /// referenced as `role` below.
  mapping(uint256 tokenId => mapping(uint256 nonce => mapping(address user => bytes32 roles)))
    private $tokenIdToNonceToUserToRoles;

  /// @notice The nonce to use for every access to `$tokenIdToNonceToUserToRoles`.
  /// @dev This structures storage to allow a user controlled `nonce` in the future, enabling delete all.
  uint256 private constant DEFAULT_NONCE = 0;

  /**
   * @notice Emitted when all token roles for a user are revoked.
   * @param tokenId The token for which this user had their roles revoked.
   * @param user The address of the user who had their roles revoked.
   */
  event UserRolesRevoked(uint256 indexed tokenId, address indexed user);

  error ERC721UserRoles_User_Has_No_Roles();
  error ERC721UserRoles_User_Must_Not_Be_Zero_Address();
  error ERC721UserRoles_User_Role_Already_Set();

  /**
   * @notice Sets a user role for a given token. Overwrites any existing roles.
   * @dev No events are emitted, the caller should emit if required allowing for user friendly naming.
   */
  function _setUserRole(uint256 tokenId, address user, uint8 role) internal {
    if (_hasUserRole(tokenId, user, role)) {
      revert ERC721UserRoles_User_Role_Already_Set();
    }

    $tokenIdToNonceToUserToRoles[tokenId][DEFAULT_NONCE][user] = bytes32(1 << role);
  }

  function _hasUserRole(uint256 tokenId, address user, uint8 role) internal view returns (bool userHasRole) {
    userHasRole = (uint256($tokenIdToNonceToUserToRoles[tokenId][DEFAULT_NONCE][user]) >> role) & 1 != 0;
  }

  /// @notice Revokes all roles for a user on a given token.
  function _revokeAllRolesForUser(uint256 tokenId, address user) internal {
    if ($tokenIdToNonceToUserToRoles[tokenId][DEFAULT_NONCE][user] == 0) {
      revert ERC721UserRoles_User_Has_No_Roles();
    }

    delete $tokenIdToNonceToUserToRoles[tokenId][DEFAULT_NONCE][user];

    emit UserRolesRevoked(tokenId, user);
  }

  /**
   * @notice 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
   * @dev This file uses a total of 200 slots.
   */
  uint256[199] private __gap;
}

File 36 of 53 : Constants.sol
// SPDX-License-Identifier: MIT OR Apache-2.0

pragma solidity ^0.8.18;

/// Constant values shared across mixins.

/**
 * @dev 100% in basis points.
 */
uint256 constant BASIS_POINTS = 10_000;

/**
 * @dev The default admin role defined by OZ ACL modules.
 */
bytes32 constant DEFAULT_ADMIN_ROLE = 0x00;

////////////////////////////////////////////////////////////////
// Royalties & Take Rates
////////////////////////////////////////////////////////////////

/**
 * @dev The max take rate a World can have.
 */
uint256 constant MAX_WORLD_TAKE_RATE = 5_000;

/**
 * @dev Cap the number of royalty recipients.
 * A cap is required to ensure gas costs are not too high when a sale is settled.
 */
uint256 constant MAX_ROYALTY_RECIPIENTS = 5;

/**
 * @dev Default royalty cut paid out on secondary sales.
 * Set to 10% of the secondary sale.
 */
uint96 constant ROYALTY_IN_BASIS_POINTS = 1_000;

/**
 * @dev Reward paid to referrers when a sale is made.
 * Set to 1% of the sale amount. This 1% is deducted from the protocol fee.
 */
uint96 constant BUY_REFERRER_IN_BASIS_POINTS = 100;

/**
 * @dev 10%, expressed as a denominator for more efficient calculations.
 */
uint256 constant ROYALTY_RATIO = BASIS_POINTS / ROYALTY_IN_BASIS_POINTS;

/**
 * @dev 1%, expressed as a denominator for more efficient calculations.
 */
uint256 constant BUY_REFERRER_RATIO = BASIS_POINTS / BUY_REFERRER_IN_BASIS_POINTS;

////////////////////////////////////////////////////////////////
// Gas Limits
////////////////////////////////////////////////////////////////

/**
 * @dev The gas limit used when making external read-only calls.
 * This helps to ensure that external calls does not prevent the market from executing.
 */
uint256 constant READ_ONLY_GAS_LIMIT = 40_000;

/**
 * @dev The gas limit to send ETH to multiple recipients, enough for a 5-way split.
 */
uint256 constant SEND_VALUE_GAS_LIMIT_MULTIPLE_RECIPIENTS = 210_000;

/**
 * @dev The gas limit to send ETH to a single recipient, enough for a contract with a simple receiver.
 */
uint256 constant SEND_VALUE_GAS_LIMIT_SINGLE_RECIPIENT = 20_000;

////////////////////////////////////////////////////////////////
// Collection Type Names
////////////////////////////////////////////////////////////////

/**
 * @dev The NFT collection type.
 */
string constant NFT_COLLECTION_TYPE = "NFT Collection";

/**
 * @dev The NFT drop collection type.
 */
string constant NFT_DROP_COLLECTION_TYPE = "NFT Drop Collection";

/**
 * @dev The NFT timed edition collection type.
 */
string constant NFT_TIMED_EDITION_COLLECTION_TYPE = "NFT Timed Edition Collection";

/**
 * @dev The NFT limited edition collection type.
 */
string constant NFT_LIMITED_EDITION_COLLECTION_TYPE = "NFT Limited Edition Collection";

////////////////////////////////////////////////////////////////
// Business Logic
////////////////////////////////////////////////////////////////

/**
 * @dev Limits scheduled start/end times to be less than 2 years in the future.
 */
uint256 constant MAX_SCHEDULED_TIME_IN_THE_FUTURE = 365 days * 2;

/**
 * @dev The minimum increase of 10% required when making an offer or placing a bid.
 */
uint256 constant MIN_PERCENT_INCREMENT_DENOMINATOR = BASIS_POINTS / 1_000;

/**
 * @dev Protocol fee for edition mints in basis points.
 */
uint256 constant EDITION_PROTOCOL_FEE_IN_BASIS_POINTS = 500;

/**
 * @dev Hash of the edition type names.
 * This is precalculated in order to save gas on use.
 * `keccak256(abi.encodePacked(NFT_TIMED_EDITION_COLLECTION_TYPE))`
 */
bytes32 constant timedEditionTypeHash = 0xee2afa3f960e108aca17013728aafa363a0f4485661d9b6f41c6b4ddb55008ee;

bytes32 constant limitedEditionTypeHash = 0x7df1f68d01ab1a6ee0448a4c3fbda832177331ff72c471b12b0051c96742eef5;

File 37 of 53 : DelegateForwarder.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { IDelegateView } from "../../interfaces/internal/IDelegateView.sol";

/**
 * @title Helper functions for using delegatecall in order to move some logic to another contract, saving space.
 * @author HardlyDifficult
 */
abstract contract DelegateForwarder {
  error DelegateForwarder_For_Internal_Use_Only();

  /**
   * @notice Delegates the current call to `implementation`.
   * @param implementation The contract to delegate calls to.
   * @dev This function does not return to its internal call site, it will return directly to the external caller.
   * From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.0.0/contracts/proxy/Proxy.sol#L22
   */
  function _delegate(address implementation) internal {
    assembly {
      // Copy msg.data. We take full control of memory in this inline assembly
      // block because it will not return to Solidity code. We overwrite the
      // Solidity scratch pad at memory position 0.
      calldatacopy(0, 0, calldatasize())

      // Call the implementation.
      // out and outsize are 0 because we don't know the size yet.
      let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

      // Copy the returned data.
      returndatacopy(0, 0, returndatasize())

      switch result
      // delegatecall returns 0 on error.
      case 0 {
        revert(0, returndatasize())
      }
      default {
        return(0, returndatasize())
      }
    }
  }

  /**
   * @notice Used internally in order to delegate a call to `implementation` in a read-only context. The return data
   * or revert reason is returned directly to the external caller.
   * @dev Execution ends after calling this helper function.
   * @param implementation The contract to delegate calls to.
   */
  function _delegateView(address implementation) internal view {
    (bool success, ) = address(this).staticcall(
      abi.encodePacked(IDelegateView._delegateView.selector, msg.data, implementation)
    );
    assembly {
      // Copy the returned data.
      returndatacopy(0, 0, returndatasize())

      switch success
      // delegatecall returns 0 on error.
      case 0 {
        revert(0, returndatasize())
      }
      default {
        return(0, returndatasize())
      }
    }
  }

  /**
   * @notice An external function used by the helper above. This allows us to call delegatecall in a read-only context,
   * but it loses the relevant msg.sender.
   * @dev This is only callable by this contract.
   */
  function _delegateView() external {
    if (msg.sender != address(this)) {
      revert DelegateForwarder_For_Internal_Use_Only();
    }

    assembly {
      // The relevant msg.data is sandwiched between a 4-byte selector and a 20-byte address.
      let size := sub(calldatasize(), 24)

      // Copy msg.data. We take full control of memory in this inline assembly
      // block because it will not return to Solidity code. We overwrite the
      // Solidity scratch pad at memory position 0.
      calldatacopy(0, 4, size)

      // Load the implementation address from the end of the calldata.
      let implementation := shr(96, calldataload(sub(calldatasize(), 20)))

      // Call the implementation.
      // out and outsize are 0 because we don't know the size yet.
      let result := delegatecall(gas(), implementation, 0, size, 0, 0)

      // Copy the returned data.
      returndatacopy(0, 0, returndatasize())

      switch result
      // delegatecall returns 0 on error.
      case 0 {
        revert(0, returndatasize())
      }
      default {
        return(0, returndatasize())
      }
    }
  }

  // This mixin uses 0 slots.
}

File 38 of 53 : RouterContextDouble.sol
// SPDX-License-Identifier: MIT OR Apache-2.0

pragma solidity ^0.8.18;

import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";

import "../../libraries/RouteCallLibrary.sol";

/**
 * @title Enables trusted contracts to override the usual msg.sender address.
 * @author HardlyDifficult & reggieag
 */
abstract contract RouterContextDouble is ContextUpgradeable {
  using AddressUpgradeable for address;

  address private immutable approvedRouterA;
  address private immutable approvedRouterB;

  constructor(address routerA, address routerB) {
    approvedRouterA = routerA;
    approvedRouterB = routerB;
  }

  /**
   * @notice Returns the contracts which are able to override the msg.sender address.
   * @return routerA The address of the 1st trusted router.
   * @return routerB The address of the 2nd trusted router.
   */
  function getApprovedRouterAddresses() external view returns (address routerA, address routerB) {
    routerA = approvedRouterA;
    routerB = approvedRouterB;
  }

  /**
   * @notice Gets the sender of the transaction to use, overriding the usual msg.sender if the caller is a trusted
   * router.
   * @dev If the msg.sender is a trusted router contract, then the last 20 bytes of the calldata represents the
   * authorized sender to use.
   * If this is used for a call that was not routed with `routeCallTo`, the address returned will be incorrect (and
   * may be address(0)).
   */
  function _msgSender() internal view virtual override returns (address sender) {
    sender = super._msgSender();
    if (sender == approvedRouterA || sender == approvedRouterB) {
      sender = RouteCallLibrary.extractAppendedSenderAddress();
    }
  }

  // This mixin uses 0 slots.
}

File 39 of 53 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)

// Modified to support a variable proxy address to use on construction, remove string fallback & use ERC-2098.

pragma solidity ^0.8.20;

import { ECDSA } from "@openzeppelin/contracts-v5/utils/cryptography/ECDSA.sol";
import { MessageHashUtils } from "@openzeppelin/contracts-v5/utils/cryptography/MessageHashUtils.sol";
import { ShortStrings, ShortString } from "@openzeppelin/contracts-v5/utils/ShortStrings.sol";
import { IERC5267 } from "@openzeppelin/contracts-v5/interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP-712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
 * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
 * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
 * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP-712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable
 */
abstract contract EIP712 is IERC5267 {
  using ShortStrings for *;

  bytes32 private constant TYPE_HASH =
    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

  // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
  // invalidate the cached domain separator if the chain id changes.
  bytes32 private immutable _cachedDomainSeparator;
  uint256 private immutable _cachedChainId;
  address private immutable _cachedThis;

  bytes32 private immutable _hashedName;
  bytes32 private immutable _hashedVersion;

  ShortString private immutable _name;
  ShortString private immutable _version;

  error EIP712_Invalid_Signer();

  /**
   * @dev Initializes the domain separator and parameter caches.
   *
   * The meaning of `name` and `version` is specified in
   * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP-712]:
   *
   * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
   * - `version`: the current major version of the signing domain.
   *
   * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
   * contract upgrade].
   */
  constructor(string memory name, string memory version, address proxyAddress) {
    _name = name.toShortString();
    _version = version.toShortString();
    _hashedName = keccak256(bytes(name));
    _hashedVersion = keccak256(bytes(version));

    _cachedChainId = block.chainid;
    _cachedDomainSeparator = _buildDomainSeparator(proxyAddress);
    _cachedThis = proxyAddress;
  }

  /**
   * @dev Returns the domain separator for the current chain.
   */
  function _domainSeparatorV4() internal view returns (bytes32) {
    if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
      return _cachedDomainSeparator;
    } else {
      return _buildDomainSeparator(address(this));
    }
  }

  function _buildDomainSeparator(address proxyAddress) private view returns (bytes32) {
    return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, proxyAddress));
  }

  /**
   * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
   * function returns the hash of the fully encoded EIP712 message for this domain.
   *
   * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
   *
   * ```solidity
   * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
   *     keccak256("Mail(address to,string contents)"),
   *     mailTo,
   *     keccak256(bytes(mailContents))
   * )));
   * address signer = ECDSA.recover(digest, signature);
   * ```
   */
  function _hashTypedDataV4(bytes32 structHash) internal view returns (bytes32) {
    return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);
  }

  function _requireEIP712Signer(
    address signer,
    bytes32 structHash,
    bytes32 signatureR,
    bytes32 signatureVs
  ) internal view {
    address recovered = ECDSA.recover(_hashTypedDataV4(structHash), signatureR, signatureVs);
    if (recovered != signer) {
      revert EIP712_Invalid_Signer();
    }
  }

  /**
   * @dev See {IERC-5267}.
   */
  function eip712Domain()
    external
    view
    returns (
      bytes1 fields,
      string memory name,
      string memory version,
      uint256 chainId,
      address verifyingContract,
      bytes32 salt,
      uint256[] memory extensions
    )
  {
    return (
      hex"0f", // 01111
      _name.toString(),
      _version.toString(),
      block.chainid,
      address(this),
      bytes32(0),
      new uint256[](0)
    );
  }
}

File 40 of 53 : WorldsAllowlist.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { MAX_WORLD_TAKE_RATE } from "../shared/Constants.sol";
import { ListingType } from "./WorldsSharedTypes.sol";

import { WorldsAllowlistBySeller } from "./WorldsAllowlistBySeller.sol";
import { WorldsAllowlistBySignature } from "./WorldsAllowlistBySignature.sol";

/**
 * @title Coordinates worlds permissions across potentially several allowlist types.
 * @author HardlyDifficult
 */
abstract contract WorldsAllowlist is WorldsAllowlistBySeller, WorldsAllowlistBySignature {
  error WorldsAllowlist_List_Type_Does_Not_Support_Listing_Identifier();
  error WorldsAllowlist_Take_Rate_Above_Max(uint256 maxTakeRate);

  /// @notice Reverts if a requested inventory addition is not allowed.
  function _authorizeInventoryAddition(
    uint256 worldId,
    address seller,
    address nftContract,
    uint256 nftTokenId,
    uint16 takeRateInBasisPoints,
    ListingType listingType,
    bytes calldata approvalData
  ) internal view returns (string memory listingIdentifier) {
    _requireMinted(worldId);

    if (takeRateInBasisPoints > MAX_WORLD_TAKE_RATE) {
      // There is a maximum take rate applied so that market contracts may make safe math assumptions.
      revert WorldsAllowlist_Take_Rate_Above_Max(MAX_WORLD_TAKE_RATE);
    }

    if (approvalData.length == 0) {
      // The seller allowlist doesn't support any additional details.
      _authorizeBySeller(worldId, takeRateInBasisPoints, seller);
    } else {
      // ATM the only other method is approve by signature. Later we can parse out the `ApprovalType` to branch here.
      listingIdentifier = _authorizeBySignature(
        worldId,
        seller,
        nftContract,
        nftTokenId,
        takeRateInBasisPoints,
        listingType,
        approvalData
      );
    }
  }

  /// @notice [DEPRECATED] Only used by deprecated functions, use `_authorizeInventoryAddition` instead.
  modifier onlyAllowedInventoryAdditionV1(uint256 worldId, uint16 takeRateInBasisPoints) {
    _requireMinted(worldId);
    if (takeRateInBasisPoints > MAX_WORLD_TAKE_RATE) {
      revert WorldsAllowlist_Take_Rate_Above_Max(MAX_WORLD_TAKE_RATE);
    }
    _authorizeBySeller(worldId, takeRateInBasisPoints, _msgSender());
    _;
  }

  /**
   * @notice 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
   * @dev This file uses a total of 10,000 slots.
   */
  uint256[10_000] private __gap;
}

File 41 of 53 : WorldsAllowlistBySeller.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";

import { IWorldsNFTMarket } from "../../interfaces/internal/IWorldsNFTMarket.sol";

import { WorldsPaymentInfo } from "./WorldsPaymentInfo.sol";
import { WorldsUserRoles } from "./WorldsUserRoles.sol";

/**
 * @title Allows curators to grant permissions to list with a World, authorized by the NFT's seller's address.
 * @author HardlyDifficult
 */
abstract contract WorldsAllowlistBySeller is IWorldsNFTMarket, WorldsUserRoles, WorldsPaymentInfo {
  struct SellerPermissions {
    bool isAllowed;
    // Per-seller take rates and other configuration may be added in the future.
  }

  /// @notice Stores permissions for individual sellers on a per-World basis.
  mapping(uint256 worldId => mapping(address seller => SellerPermissions permissions))
    private $worldIdToSellerToPermissions;

  /**
   * @notice Emitted when a seller is added to an allowlist.
   * @param worldId The World the seller was added to.
   * @param seller The seller which was given permissions to list with a World.
   */
  event AddToAllowlistBySeller(uint256 indexed worldId, address indexed seller);

  /**
   * @notice Emitted when a seller is removed from an allowlist.
   * @param worldId The World the seller was removed from.
   * @param seller The seller which was removed from the allowlist.
   */
  event RemoveFromAllowlistBySeller(uint256 indexed worldId, address indexed seller);

  error WorldsAllowlistBySeller_Address_0_May_Not_Be_Added();
  error WorldsAllowlistBySeller_No_Sellers_Provided();
  error WorldsAllowlistBySeller_Seller_Already_On_Allowlist();
  error WorldsAllowlistBySeller_Seller_Not_Allowed();
  error WorldsAllowlistBySeller_Take_Rate_Too_Low(uint16 minimumTakeRateInBasisPoints);

  ////////////////////////////////////////////////////////////////
  // Management
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Adds a seller to the allowlist for a World.
   * @param worldId The World the seller is being added to.
   * @param seller The seller to give permissions to list with a World.
   * @dev Callable by the World owner, admin, or editor.
   */
  function addToAllowlistBySeller(uint256 worldId, address seller) external onlyEditor(worldId) {
    _addToAllowlistBySeller(worldId, seller);
  }

  /**
   * @notice Adds a list of sellers to the allowlist for a World.
   * @param worldId The World the seller is being added to.
   * @param sellers The list of sellers to give permissions to list with a World.
   * @dev Callable by the World owner, admin, or editor.
   */
  function addToAllowlistBySellers(uint256 worldId, address[] calldata sellers) external onlyEditor(worldId) {
    if (sellers.length == 0) {
      revert WorldsAllowlistBySeller_No_Sellers_Provided();
    }

    _addToAllowlistBySellers(worldId, sellers);
  }

  /// @dev Assumes that permission checks have already been performed.
  function _addToAllowlistBySellers(uint256 worldId, address[] calldata sellers) internal {
    for (uint256 i = 0; i < sellers.length; ++i) {
      _addToAllowlistBySeller(worldId, sellers[i]);
    }
  }

  function _addToAllowlistBySeller(uint256 worldId, address seller) internal {
    if (seller == address(0)) {
      revert WorldsAllowlistBySeller_Address_0_May_Not_Be_Added();
    }

    SellerPermissions storage permissions = $worldIdToSellerToPermissions[worldId][seller];
    if (permissions.isAllowed) {
      revert WorldsAllowlistBySeller_Seller_Already_On_Allowlist();
    }

    permissions.isAllowed = true;

    emit AddToAllowlistBySeller(worldId, seller);
  }

  /**
   * @notice Removes a seller from the allowlist for a World.
   * @param worldId The World the seller is being removed from.
   * @param seller The seller to remove permissions to list with a World.
   * @dev Callable by the World owner, admin, or editor.
   */
  function removeFromAllowlistBySeller(uint256 worldId, address seller) external onlyEditor(worldId) {
    SellerPermissions storage permissions = $worldIdToSellerToPermissions[worldId][seller];

    if (!permissions.isAllowed) {
      revert WorldsAllowlistBySeller_Seller_Not_Allowed();
    }
    delete $worldIdToSellerToPermissions[worldId][seller];

    emit RemoveFromAllowlistBySeller(worldId, seller);
  }

  ////////////////////////////////////////////////////////////////
  // Authorization
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Reverts if the seller is not allowed to list with a World.
   * @param worldId The World the seller is trying to list with.
   * @param seller The seller trying to list with a World.
   */
  function _authorizeBySeller(uint256 worldId, uint16 takeRateInBasisPoints, address seller) internal view {
    if (!$worldIdToSellerToPermissions[worldId][seller].isAllowed) {
      revert WorldsAllowlistBySeller_Seller_Not_Allowed();
    }
    if (takeRateInBasisPoints < getDefaultTakeRate(worldId)) {
      revert WorldsAllowlistBySeller_Take_Rate_Too_Low(getDefaultTakeRate(worldId));
    }
  }

  /**
   * @notice Returns true if the seller is allowed to list with a World.
   * @param worldId The World the seller is trying to list with.
   * @param seller The seller trying to list with a World.
   * @dev Always returns false if the World DNE or has been burned.
   */
  function isSellerAllowed(uint256 worldId, address seller) external view returns (bool isAllowed) {
    if (_ownerOf(worldId) != address(0)) {
      isAllowed = $worldIdToSellerToPermissions[worldId][seller].isAllowed;
    }
  }

  ////////////////////////////////////////////////////////////////
  // Inheritance Requirements
  // (no-ops to avoid compile errors)
  ////////////////////////////////////////////////////////////////

  function _burn(uint256 tokenId) internal virtual override(ERC721Upgradeable, WorldsPaymentInfo) {
    super._burn(tokenId);
  }

  /**
   * @notice 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
   * @dev This file uses a total of 1,000 slots.
   */
  uint256[999] private __gap;
}

File 42 of 53 : WorldsAllowlistBySignature.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { TimeLibrary } from "../../libraries/TimeLibrary.sol";

import { ApprovalType, ListingType } from "./WorldsSharedTypes.sol";
import { EIP712 } from "./EIP712.sol";

/**
 * @title Allows listing NFTs with a World by signature.
 * @author HardlyDifficult
 */
abstract contract WorldsAllowlistBySignature is EIP712 {
  using TimeLibrary for uint256;

  error WorldsAllowlistBySignature_Invalid_Approval_Type();
  error WorldsAllowlistBySignature_Signer_Is_Required();
  error WorldsAllowlistBySignature_Tx_Deadline_Expired();
  error WorldsAllowlistBySignature_Tx_Deadline_Too_Far_In_Future(uint256 maxExpiration);

  /// @notice The EIP-712 typeHash for the approval struct used by this contract.
  bytes32 private immutable authorizeBySignatureTypeHash;

  /// @notice The account which has permission to sign approvals.
  /// @dev This is currently a single global account, in the future a role will be used.
  address private immutable trustedSigner;

  /**
   * @notice Set immutable variables for the implementation contract.
   * @param _trustedSigner The account which has permission to sign approvals.
   */
  constructor(address _trustedSigner) {
    if (_trustedSigner == address(0)) {
      revert WorldsAllowlistBySignature_Signer_Is_Required();
    }

    authorizeBySignatureTypeHash = keccak256(
      // solhint-disable-next-line max-line-length
      "AuthorizeBySignature(uint256 worldId,address seller,address nftContract,uint256 nftTokenId,uint16 takeRateInBasisPoints,uint8 listingType,string listingIdentifier,uint256 expiration)"
    );

    trustedSigner = _trustedSigner;
  }

  /// @notice The account which has permission to sign approvals.
  function getTrustedSignerAddress() external view returns (address signer) {
    signer = trustedSigner;
  }

  /// @notice Reverts if the signature is invalid, otherwise returns the listingIdentifier packed in approvalData.
  /// @param nftTokenId Set to 0 if listing a collection.
  function _authorizeBySignature(
    uint256 worldId,
    address seller,
    address nftContract,
    uint256 nftTokenId,
    uint16 takeRateInBasisPoints,
    ListingType listingType,
    bytes calldata approvalData
  ) internal view returns (string memory listingIdentifier) {
    ApprovalType approvalType;
    uint256 expiration;
    bytes32 signatureR;
    bytes32 signatureVs;
    (approvalType, listingIdentifier, expiration, signatureR, signatureVs) = abi.decode(
      approvalData,
      (ApprovalType, string, uint256, bytes32, bytes32)
    );
    if (approvalType != ApprovalType.AuthorizeBySignature) {
      // In the future, this type of check should occur in WorldsAllowlist instead.
      revert WorldsAllowlistBySignature_Invalid_Approval_Type();
    }
    if (expiration.hasExpired()) {
      revert WorldsAllowlistBySignature_Tx_Deadline_Expired();
    }
    if (expiration > block.timestamp + 1 days) {
      // Since there is no replay protection and no ability to cancel sigs, we require short approval windows.
      revert WorldsAllowlistBySignature_Tx_Deadline_Too_Far_In_Future(block.timestamp + 1 days);
    }

    bytes32 structHash = keccak256(
      abi.encode(
        authorizeBySignatureTypeHash,
        worldId,
        seller,
        nftContract,
        nftTokenId,
        takeRateInBasisPoints,
        listingType,
        // Strings are hashed as per the EIP-712 standard.
        keccak256(bytes(listingIdentifier)),
        expiration
      )
    );

    // Reverts if the signature is invalid.
    _requireEIP712Signer(trustedSigner, structHash, signatureR, signatureVs);
  }
}

File 43 of 53 : WorldsCore.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

/**
 * @title A place for common modifiers and functions used by various Worlds mixins, if any.
 * @author HardlyDifficult
 */
abstract contract WorldsCore {
  /**
   * @notice 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
   * @dev This file uses a total of 10,000 slots.
   */
  uint256[10_000] private __gap;
}

File 44 of 53 : WorldsInventoryByCollection.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { SafeCast } from "@openzeppelin/contracts-v5/utils/math/SafeCast.sol";
import { ListingType } from "./WorldsSharedTypes.sol";

import { IWorldsDropMarket } from "../../interfaces/internal/IWorldsDropMarket.sol";

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

/**
 * @title Allows listing collections with a World.
 * @author HardlyDifficult
 */
abstract contract WorldsInventoryByCollection is IWorldsDropMarket, WorldsAllowlist {
  using SafeCast for uint256;

  struct CollectionInventorySettings {
    uint32 worldId;
    uint16 takeRateInBasisPoints;
  }

  /// @notice The settings for each Collection that is listed with a World.
  mapping(address seller => mapping(address nftContract => CollectionInventorySettings settings))
    private $sellerToNftContractToSettings;

  /**
   * @notice Emitted when an NFT Collection is added to a World.
   * @param worldId The ID of the World that the NFT Collection was added to.
   * @param seller The address of the seller that added the NFT Collection to the World.
   * @param nftContract The address of the collection that was added to the World.
   * @param takeRateInBasisPoints The take rate the seller agreed to pay if the NFT Collection is sold.
   * @param listingIdentifier An optional, curator approved identifier for this listing.
   */
  event AddToWorldByCollection(
    uint256 indexed worldId,
    address indexed seller,
    address indexed nftContract,
    uint16 takeRateInBasisPoints,
    string listingIdentifier
  );

  /**
   * @notice Emitted when NFT(s) from a collection in a World is sold.
   * @param worldId The ID of the World that was credited with the sale.
   * @param marketplace The address of the marketplace that sold the NFT(s).
   * @param seller The address of the seller that added the NFT Collection to the World.
   * @param nftContract The address of the collection that was added to the World.
   * @param count The number of NFT(s) sold.
   * @param totalSalePrice The total sale price of the NFT(s) sold.
   * @param takeRateInBasisPoints The take rate the seller agreed to pay when NFTs are sold.
   */
  event SoldInWorldByCollection(
    uint256 indexed worldId,
    address indexed marketplace,
    address indexed seller,
    address nftContract,
    uint256 count,
    uint256 totalSalePrice,
    uint16 takeRateInBasisPoints
  );

  ////////////////////////////////////////////////////////////////
  // Inventory Management
  ////////////////////////////////////////////////////////////////
  /**
   * @notice Add an NFT Collection to a World for the msg.sender as the seller.
   * @dev A trusted router can select the seller which is used here.
   * @param worldId The ID of the World to add the NFT Collection to.
   * @param nftContract The address of the NFT Collection to add to the World.
   * @param takeRateInBasisPoints The take rate the seller agrees to pay if the NFT Collection is sold.
   * @param approvalData Additional data and approval information for the listing, or an empty array if not applicable.
   */
  function addToWorldByCollectionV2(
    uint256 worldId,
    address nftContract,
    uint16 takeRateInBasisPoints,
    bytes calldata approvalData
  ) external {
    address seller = _msgSender();
    string memory listingIdentifier = _authorizeInventoryAddition({
      worldId: worldId,
      seller: seller,
      nftContract: nftContract,
      nftTokenId: 0,
      takeRateInBasisPoints: takeRateInBasisPoints,
      listingType: ListingType.Collection,
      approvalData: approvalData
    });
    _addToWorldByCollection(worldId, seller, nftContract, takeRateInBasisPoints, listingIdentifier);
  }

  /**
   * @notice [DEPRECATED] Use `addToWorldByCollectionV2` instead.
   */
  function addToWorldByCollection(
    uint256 worldId,
    address nftContract,
    uint16 takeRateInBasisPoints
  ) external onlyAllowedInventoryAdditionV1(worldId, takeRateInBasisPoints) {
    _addToWorldByCollection(worldId, _msgSender(), nftContract, takeRateInBasisPoints, "");
  }

  function _addToWorldByCollection(
    uint256 worldId,
    address seller,
    address nftContract,
    uint16 takeRateInBasisPoints,
    string memory listingIdentifier
  ) internal {
    $sellerToNftContractToSettings[seller][nftContract] = CollectionInventorySettings(
      worldId.toUint32(),
      takeRateInBasisPoints
    );

    emit AddToWorldByCollection(worldId, seller, nftContract, takeRateInBasisPoints, listingIdentifier);
  }

  /**
   * @notice Returns the World association for an NFT Collection that is listed with a World, or zeros if not listed.
   * @param nftContract The address of the NFT Collection that was added to the World.
   * @param seller The address of the seller that added the NFT Collection to the World.
   * @return worldId The ID of the World that the NFT Collection was added to.
   * @return takeRateInBasisPoints The take rate the seller agreed to pay if the NFT Collection is sold.
   */
  function getAssociationByCollection(
    address nftContract,
    address seller
  ) external view returns (uint256 worldId, uint16 takeRateInBasisPoints) {
    worldId = $sellerToNftContractToSettings[seller][nftContract].worldId;
    if (_ownerOf(worldId) != address(0)) {
      // If a World association was found and has not been burned, then return the take rate as well.
      takeRateInBasisPoints = $sellerToNftContractToSettings[seller][nftContract].takeRateInBasisPoints;
    } else {
      // Otherwise return (0, 0).
      worldId = 0;
    }
  }

  ////////////////////////////////////////////////////////////////
  // Sales
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Called by the marketplace when an NFT is sold, emitting sale details and returning the expected payment
   * info.
   * @param seller The address of the seller that added the NFT Collection to the World.
   * @param nftContract The address of the collection that was added to the World.
   * @param count The number of NFT(s) sold.
   * @param totalSalePrice The total sale price of the NFT(s) sold.
   * @return worldId The ID of the World that was credited with the sale.
   * @return worldPaymentAddress The address that should receive the payment for the sale.
   * @return takeRateInBasisPoints The take rate the seller agreed to pay when NFTs are sold.
   */
  function soldInWorldByCollection(
    address seller,
    address nftContract,
    uint256 count,
    uint256 totalSalePrice
  ) external returns (uint256 worldId, address payable worldPaymentAddress, uint16 takeRateInBasisPoints) {
    worldId = $sellerToNftContractToSettings[seller][nftContract].worldId;
    if (worldId != 0) {
      worldPaymentAddress = getPaymentAddress(worldId);
      if (worldPaymentAddress == address(0)) {
        // The World has since been burned, so ignore the relationship.
        worldId = 0;
        worldPaymentAddress = payable(0);
      } else {
        takeRateInBasisPoints = $sellerToNftContractToSettings[seller][nftContract].takeRateInBasisPoints;

        emit SoldInWorldByCollection({
          worldId: worldId,
          marketplace: msg.sender,
          seller: seller,
          nftContract: nftContract,
          count: count,
          totalSalePrice: totalSalePrice,
          takeRateInBasisPoints: takeRateInBasisPoints
        });
      }
    }
  }

  /**
   * @notice 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
   * @dev This file uses a total of 500 slots.
   */
  uint256[499] private __gap;
}

File 45 of 53 : WorldsInventoryByNft.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { SafeCast } from "@openzeppelin/contracts-v5/utils/math/SafeCast.sol";

import { IWorldsSharedMarket } from "../../interfaces/internal/IWorldsSharedMarket.sol";
import { IWorldsNFTMarket } from "../../interfaces/internal/IWorldsNFTMarket.sol";
import { ListingType } from "./WorldsSharedTypes.sol";

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

/**
 * @title Allows listing NFTs with a World.
 * @author HardlyDifficult
 */
abstract contract WorldsInventoryByNft is IWorldsNFTMarket, IWorldsSharedMarket, WorldsAllowlist {
  using SafeCast for uint256;

  struct NftInventorySettings {
    uint32 worldId;
    uint16 takeRateInBasisPoints;
  }

  /// @notice The settings for each NFT that is listed with a World.
  // solhint-disable-next-line max-line-length
  mapping(address seller => mapping(address nftContract => mapping(uint256 nftTokenId => NftInventorySettings settings)))
    private $sellerToNftContractToTokenIdToSettings;

  /**
   * @notice Emitted when an NFT is added to a World.
   * @param worldId The ID of the World that the NFT was added to.
   * @param seller The address of the seller that added the NFT to the World.
   * @param nftContract The address of the collection for the NFT that was added to the World.
   * @param nftTokenId The tokenID of the NFT that was added to the World.
   * @param takeRateInBasisPoints The take rate the seller agreed to pay if the NFT is sold.
   * @param listingIdentifier An optional, curator approved identifier for this listing.
   */
  event AddToWorldByNft(
    uint256 indexed worldId,
    address indexed seller,
    address indexed nftContract,
    uint256 nftTokenId,
    uint16 takeRateInBasisPoints,
    string listingIdentifier
  );

  /**
   * @notice Emitted when an NFT is remove from a World.
   * @param worldId The ID of the World that the NFT was previous a part of.
   * @param seller The address of the seller that removed the NFT from the World.
   * @param nftContract The address of the collection for the NFT that was removed from the World.
   * @param nftTokenId The tokenID of the NFT that was removed from the World.
   */
  event RemoveFromWorldByNft(
    uint256 indexed worldId,
    address indexed seller,
    address indexed nftContract,
    uint256 nftTokenId
  );

  /**
   * @notice Emitted when an NFT in a World is sold.
   * @param worldId The ID of the World that was credited with the sale.
   * @param marketplace The address of the marketplace that sold the NFT.
   * @param seller The address of the seller that added the NFT to the World.
   * @param nftContract The address of the collection for the NFT that was added to the World.
   * @param nftTokenId The tokenID of the NFT that was added to the World.
   * @param buyer The address of the buyer that purchased the NFT.
   * @param salePrice The total sale price of the NFT sold.
   * @param takeRateInBasisPoints The take rate the seller agreed to pay when NFTs are sold.
   */
  event SoldInWorldByNft(
    uint256 indexed worldId,
    address indexed marketplace,
    address indexed seller,
    address nftContract,
    uint256 nftTokenId,
    address buyer,
    uint256 salePrice,
    uint16 takeRateInBasisPoints
  );

  ////////////////////////////////////////////////////////////////
  // Inventory Management
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Add an NFT to a World for the msg.sender as the seller.
   * @dev A trusted router can select the seller which is used here.
   * @param worldId The ID of the World to add the NFT to.
   * @param nftContract The address of the collection for the NFT to add to the World.
   * @param nftTokenId The tokenID of the NFT to add to the World.
   * @param takeRateInBasisPoints The take rate the seller agrees to pay if the NFT is sold.
   * @param approvalData Additional data and approval information for the listing, or an empty array if not applicable.
   */
  function addToWorldByNftV2(
    uint256 worldId,
    address nftContract,
    uint256 nftTokenId,
    uint16 takeRateInBasisPoints,
    bytes calldata approvalData
  ) external {
    address seller = _msgSender();
    string memory listingIdentifier = _authorizeInventoryAddition(
      worldId,
      seller,
      nftContract,
      nftTokenId,
      takeRateInBasisPoints,
      ListingType.NFT,
      approvalData
    );
    _addToWorldByNft(worldId, seller, nftContract, nftTokenId, takeRateInBasisPoints, listingIdentifier);
  }

  /**
   * @notice [DEPRECATED] Use `addToWorldByNftV2` instead.
   */
  function addToWorldByNft(
    uint256 worldId,
    address nftContract,
    uint256 nftTokenId,
    uint16 takeRateInBasisPoints
  ) external onlyAllowedInventoryAdditionV1(worldId, takeRateInBasisPoints) {
    _addToWorldByNft(worldId, _msgSender(), nftContract, nftTokenId, takeRateInBasisPoints, "");
  }

  function _addToWorldByNft(
    uint256 worldId,
    address seller,
    address nftContract,
    uint256 nftTokenId,
    uint16 takeRateInBasisPoints,
    string memory listingIdentifier
  ) internal {
    uint256 previousWorld = $sellerToNftContractToTokenIdToSettings[seller][nftContract][nftTokenId].worldId;

    if (previousWorld != 0) {
      // Emit the event indicating the previous NFT association was removed
      emit RemoveFromWorldByNft(previousWorld, seller, nftContract, nftTokenId);
    }

    $sellerToNftContractToTokenIdToSettings[seller][nftContract][nftTokenId] = NftInventorySettings(
      worldId.toUint32(),
      takeRateInBasisPoints
    );

    emit AddToWorldByNft(worldId, seller, nftContract, nftTokenId, takeRateInBasisPoints, listingIdentifier);
  }

  /**
   * @notice Remove an NFT from a World for the sender as the seller.
   * @param nftContract The address of the collection for the NFT to remove from the World it currently belongs to.
   * @param nftTokenId The tokenID of the NFT to remove from the World it currently belongs to.
   */
  function removeFromWorldByNft(address nftContract, uint256 nftTokenId) external {
    address seller = _msgSender();
    uint256 previousWorldId = $sellerToNftContractToTokenIdToSettings[seller][nftContract][nftTokenId].worldId;
    if (previousWorldId == 0) {
      revert IWorldsSharedMarket.WorldsInventoryByNft_Not_In_A_World();
    }

    delete $sellerToNftContractToTokenIdToSettings[seller][nftContract][nftTokenId];

    emit RemoveFromWorldByNft(previousWorldId, seller, nftContract, nftTokenId);
  }

  /**
   * @notice Returns the World association for an NFT that is listed with a World, or zeros if not listed.
   * @param nftContract The address of the collection for the NFT that was added to a World.
   * @param nftTokenId The tokenID of the NFT that was added to a World.
   * @param seller The address of the seller that added the NFT to a World.
   * @return worldId The ID of the World that the NFT was added to.
   * @return takeRateInBasisPoints The take rate the seller agreed to pay if the NFT is sold.
   */
  function getAssociationByNft(
    address nftContract,
    uint256 nftTokenId,
    address seller
  ) external view returns (uint256 worldId, uint16 takeRateInBasisPoints) {
    worldId = $sellerToNftContractToTokenIdToSettings[seller][nftContract][nftTokenId].worldId;
    if (worldId != 0 && _ownerOf(worldId) != address(0)) {
      // If a World association was found and has not been burned, then return the take rate as well.
      takeRateInBasisPoints = $sellerToNftContractToTokenIdToSettings[seller][nftContract][nftTokenId]
        .takeRateInBasisPoints;
    } else {
      // Otherwise return (0, 0).
      worldId = 0;
    }
  }

  ////////////////////////////////////////////////////////////////
  // Sales
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Called by the marketplace when an NFT is sold, emitting sale details and returning the expected payment
   * info.
   * @param seller The address of the seller that added the NFT to the World.
   * @param nftContract The address of the collection that was added to the World.
   * @param nftTokenId The tokenID of the NFT that was added to the World.
   * @param buyer The address of the buyer that purchased the NFT.
   * @param salePrice The sale price of the NFT sold.
   * @return worldId The ID of the World that was credited with the sale.
   * @return worldPaymentAddress The address that should receive the payment for the sale.
   * @return takeRateInBasisPoints The take rate the seller agreed to pay when NFTs are sold.
   */
  function soldInWorldByNft(
    address seller,
    address nftContract,
    uint256 nftTokenId,
    address buyer,
    uint256 salePrice
  ) external returns (uint256 worldId, address payable worldPaymentAddress, uint16 takeRateInBasisPoints) {
    worldId = $sellerToNftContractToTokenIdToSettings[seller][nftContract][nftTokenId].worldId;
    if (worldId != 0) {
      worldPaymentAddress = getPaymentAddress(worldId);
      if (worldPaymentAddress == address(0)) {
        // The World has since been burned, so ignore the relationship.
        worldId = 0;
        worldPaymentAddress = payable(0);
      } else {
        takeRateInBasisPoints = $sellerToNftContractToTokenIdToSettings[seller][nftContract][nftTokenId]
          .takeRateInBasisPoints;
        // Cannot clear on sale here since the market is not authorized

        emit SoldInWorldByNft(
          worldId,
          msg.sender,
          seller,
          nftContract,
          nftTokenId,
          buyer,
          salePrice,
          takeRateInBasisPoints
        );
      }
    }
  }

  /**
   * @notice 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
   * @dev This file uses a total of 1,000 slots.
   */
  uint256[999] private __gap;
}

File 46 of 53 : WorldsInventoryBySplit.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { IOwnable } from "../../interfaces/standards/IOwnable.sol";
import { IWorldSplit } from "../../interfaces/internal/IWorldSplit.sol";
import { IWorldsInventoryBySplit } from "../../interfaces/internal/IWorldsInventoryBySplit.sol";
import { ListingType } from "./WorldsSharedTypes.sol";

import { AddressUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import { Clones } from "@openzeppelin/contracts-v5/proxy/Clones.sol";
import { SafeCast } from "@openzeppelin/contracts-v5/utils/math/SafeCast.sol";

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

import { BASIS_POINTS } from "../shared/Constants.sol";

/**
 * @title Allows listing collections with a World which uses a split contract to share revenue with the World curator.
 * @author HardlyDifficult
 */
abstract contract WorldsInventoryBySplit is IWorldsInventoryBySplit, WorldsAllowlist {
  using AddressUpgradeable for address;
  using Clones for address;
  using SafeCast for uint256;

  /// @notice Stores the configuration for each active World Split contract.
  struct SplitInventorySettings {
    address nftContract;
    uint32 worldId;
    uint16 takeRateInBasisPoints;
    address seller;
  }

  /// @notice Stores the World Split address by seller & nftContract.
  mapping(address seller => mapping(address nftContract => address payable split)) private $sellerToNftContractToSplit;

  /// @notice Stores the configuration for each active World Split contract.
  mapping(address split => SplitInventorySettings settings) private $splitToSettings;

  /// @notice The template used when creating new World Split contracts.
  address private immutable splitTemplate;

  /**
   * @notice Emitted when a collection is added to a World using a World Split contract for payments.
   * @param worldId The ID of the World that the NFT Collection was added to.
   * @param seller The address of the seller that added the NFT Collection to the World.
   * @param nftContract The address of the NFT Collection that was added to the World.
   * @param split The address of the contract that was created for this listing where payments should be sent.
   * @param takeRateInBasisPoints The take rate the seller agrees to pay if the NFT Collection is sold.
   * @param listingIdentifier An optional, curator approved identifier for this listing.
   */
  event AddToWorldBySplit(
    uint256 indexed worldId,
    address indexed seller,
    address indexed nftContract,
    address split,
    uint16 takeRateInBasisPoints,
    string listingIdentifier
  );

  /**
   * @notice Emitted when a sale occurs in a World using a World Split contract for payments.
   * @param worldId The ID of the World that the NFT Collection was added to.
   * @param marketplace The address of the marketplace where the sale occurred.
   * @param split The address of the World Split contract that was used for this sale.
   * @param valueInWei The amount of ETH that was sent to the split contract.
   * @param curatorTakeInWei The amount of ETH that should be sent to the World's payment address.
   */
  event SoldInWorldBySplit(
    uint256 indexed worldId,
    address indexed marketplace,
    address indexed split,
    uint256 valueInWei,
    uint256 curatorTakeInWei
  );

  /**
   * @notice Emitted when a sale occurs in a World using a World Split contract for payments, but the payment to the
   * World's payment address reverts. When this occurs, funds which would have gone to the World are sent to the creator
   * instead.
   * @param worldId The ID of the World that the NFT Collection was added to.
   * @param marketplace The address of the marketplace where the sale occurred.
   * @param split The address of the World Split contract that was used for this sale.
   * @param worldPaymentAddress The address of the World's payment address.
   * @param valueInWei The amount of ETH that was sent to the split contract.
   * @param curatorTakeInWei The amount of ETH that should be sent to the World's payment address.
   */
  event SoldInWorldBySplitWorldPaymentFailed(
    uint256 indexed worldId,
    address indexed marketplace,
    address indexed split,
    address worldPaymentAddress,
    uint256 valueInWei,
    uint256 curatorTakeInWei
  );

  error WorldsInventoryBySplit_Not_A_Valid_Split();
  error WorldsInventoryBySplit_Not_Listed_In_A_World();
  error WorldsInventoryBySplit_Split_Implementation_Not_A_Contract();

  ////////////////////////////////////////////////////////////////
  // Setup
  ////////////////////////////////////////////////////////////////

  constructor(address _splitTemplate) {
    if (!_splitTemplate.isContract()) {
      revert WorldsInventoryBySplit_Split_Implementation_Not_A_Contract();
    }
    splitTemplate = _splitTemplate;
  }

  /**
   * @notice Returns the World Split template used when new splits are created.
   */
  function getWorldSplitTemplateAddress() external view returns (address worldSplitTemplate) {
    worldSplitTemplate = splitTemplate;
  }

  ////////////////////////////////////////////////////////////////
  // Inventory Management
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Associate a collection with a World by way of a World Split contract.
   * @dev This function may be used to change associated worlds, take rate, or payment address.
   * If the payment address changes, a new split is created, otherwise it will reuse the existing split contract.
   * @param worldId The ID of the World to add the NFT Collection to.
   * @param nftContract The address of the NFT Collection to add to the World.
   * @param takeRateInBasisPoints The take rate the seller agrees to pay if the NFT Collection is sold.
   * @param creatorPaymentAddress The address to receive creator revenue from sales.
   * @param approvalData Additional data and approval information for the listing, or an empty array if not applicable.
   */
  function addToWorldBySplitV2(
    uint256 worldId,
    address nftContract,
    uint16 takeRateInBasisPoints,
    address payable creatorPaymentAddress,
    bytes calldata approvalData
  ) public returns (address payable split) {
    address seller = _msgSender();
    string memory listingIdentifier = _authorizeInventoryAddition({
      worldId: worldId,
      seller: seller,
      nftContract: nftContract,
      nftTokenId: 0,
      takeRateInBasisPoints: takeRateInBasisPoints,
      listingType: ListingType.Split,
      approvalData: approvalData
    });
    split = _addToWorldBySplit(
      worldId,
      seller,
      nftContract,
      takeRateInBasisPoints,
      creatorPaymentAddress,
      listingIdentifier
    );
  }

  /**
   * @notice [DEPRECATED] Use `addToWorldBySplitV2` instead.
   */
  function addToWorldBySplit(
    uint256 worldId,
    address nftContract,
    uint16 takeRateInBasisPoints,
    address payable creatorPaymentAddress
  ) external onlyAllowedInventoryAdditionV1(worldId, takeRateInBasisPoints) returns (address payable split) {
    split = _addToWorldBySplit(worldId, _msgSender(), nftContract, takeRateInBasisPoints, creatorPaymentAddress, "");
  }

  function _addToWorldBySplit(
    uint256 worldId,
    address seller,
    address nftContract,
    uint16 takeRateInBasisPoints,
    address payable creatorPaymentAddress,
    string memory listingIdentifier
  ) private returns (address payable split) {
    split = $sellerToNftContractToSplit[seller][nftContract];
    if (split != address(0) && (IOwnable(split).owner() == creatorPaymentAddress || creatorPaymentAddress == split)) {
      // An existing split has already been created and can be reused.
      // Update with the new configuration.
      $splitToSettings[split].worldId = worldId.toUint32();
      $splitToSettings[split].takeRateInBasisPoints = takeRateInBasisPoints;
    } else {
      if (split != address(0)) {
        // A split was previously created for this seller & contract, but the payment address has changed.
        // Retire the old split, allowing it to fallback to sending all ETH received to the seller.
        delete $splitToSettings[split];
      }

      // Create a new split contract.
      split = payable(splitTemplate.clone());
      IWorldSplit(split).initialize(creatorPaymentAddress);

      // Store settings
      $sellerToNftContractToSplit[seller][nftContract] = split;
      $splitToSettings[split] = SplitInventorySettings(nftContract, worldId.toUint32(), takeRateInBasisPoints, seller);
    }

    emit AddToWorldBySplit(worldId, seller, nftContract, split, takeRateInBasisPoints, listingIdentifier);
  }

  /**
   * @notice Returns the World association for an NFT Collection that is listed with a World via a World Split or zeros
   * if not listed.
   * @param nftContract The address of the NFT Collection that was added to the World.
   * @param seller The address of the seller that added the NFT Collection to the World.
   * @return split The address of the World Split contract that was created for this listing.
   * @return worldId The ID of the World that the NFT Collection was added to.
   * @return takeRateInBasisPoints The take rate the seller agreed to pay if the NFT Collection is sold.
   */
  function getAssociationBySplit(
    address nftContract,
    address seller
  ) external view returns (address payable split, uint256 worldId, uint16 takeRateInBasisPoints) {
    split = $sellerToNftContractToSplit[seller][nftContract];
    if (split != address(0)) {
      worldId = $splitToSettings[split].worldId;

      if (_ownerOf(worldId) != address(0)) {
        // If a World association was found and has not been burned, then return the take rate as well.
        takeRateInBasisPoints = $splitToSettings[split].takeRateInBasisPoints;
      } else {
        // Otherwise return (split, 0, 0).
        worldId = 0;
      }
    }
  }

  /**
   * @notice Returns the World association for a World Split contract, or zeros if not currently listed.
   * @param split The address of the World Split contract that was created for this listing.
   * @return worldId The ID of the World that the NFT Collection was added to.
   * @return nftContract The address of the NFT Collection that was added to the World.
   * @return seller The address of the seller that added the NFT Collection to the World.
   * @return takeRateInBasisPoints The take rate the seller agreed to pay if the NFT Collection is sold.
   */
  function getAssociationBySplitAddress(
    address split
  ) external view returns (uint256 worldId, address nftContract, address seller, uint16 takeRateInBasisPoints) {
    SplitInventorySettings storage settings = $splitToSettings[split];
    worldId = settings.worldId;
    if (_ownerOf(worldId) != address(0)) {
      // If a World association was found and has not been burned, then return the take rate as well.
      nftContract = settings.nftContract;
      seller = settings.seller;
      takeRateInBasisPoints = settings.takeRateInBasisPoints;
    } else {
      // Otherwise return zeros.
      worldId = 0;
    }
  }

  ////////////////////////////////////////////////////////////////
  // Sales
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Not for direct use.
   * @dev Called by the split contract when a sale occurs.
   * @param market The address of the marketplace where the sale occurred.
   * @param valueInWei The amount of ETH that was sent to the split contract.
   * @return worldPaymentAddress The address of the World's payment address.
   * @return curatorTakeInWei The amount of ETH that should be sent to the World's payment address.
   */
  function soldInWorldBySplit(
    address market,
    uint256 valueInWei
  ) external returns (address payable worldPaymentAddress, uint256 curatorTakeInWei) {
    uint256 worldId;
    (worldId, worldPaymentAddress, curatorTakeInWei) = _calcWorldSplit(valueInWei);

    emit SoldInWorldBySplit({
      worldId: worldId,
      marketplace: market,
      split: msg.sender,
      valueInWei: valueInWei,
      curatorTakeInWei: curatorTakeInWei
    });
  }

  /**
   * @notice Not for direct use.
   * @dev Called by the split contract if payment to the World's payment address reverts. When this occurs, funds which
   * would have gone to the World are sent to the creator instead.
   * @param market The address of the marketplace where the sale occurred.
   * @param valueInWei The amount of ETH that was sent to the split contract.
   */
  function soldInWorldBySplitWorldPaymentFailed(address market, uint256 valueInWei) external {
    (uint256 worldId, address payable worldPaymentAddress, uint256 curatorTakeInWei) = _calcWorldSplit(valueInWei);

    emit SoldInWorldBySplitWorldPaymentFailed({
      worldId: worldId,
      marketplace: market,
      split: msg.sender,
      worldPaymentAddress: worldPaymentAddress,
      valueInWei: valueInWei,
      curatorTakeInWei: curatorTakeInWei
    });
  }

  /// @notice Shared logic to determine how to split the value sent to a World Split contract.
  function _calcWorldSplit(
    uint256 valueInWei
  ) private view returns (uint256 worldId, address payable worldPaymentAddress, uint256 curatorTakeInWei) {
    SplitInventorySettings storage settings = $splitToSettings[msg.sender];
    worldId = settings.worldId;
    worldPaymentAddress = getPaymentAddress(worldId);
    if (worldPaymentAddress == address(0)) {
      if (worldId == 0) {
        // A more specific error message for this scenario.
        revert WorldsInventoryBySplit_Not_A_Valid_Split();
      }

      // The World has since been burned.
      revert WorldsInventoryBySplit_Not_Listed_In_A_World();
    }

    unchecked {
      // Safe math is not required since we trust the split implementation to pass forward value in terms of ETH which
      // will be significantly less than 256 bits and takeRateInBasisPoints is capped to 10k.
      curatorTakeInWei = (valueInWei * settings.takeRateInBasisPoints) / BASIS_POINTS;
    }
  }

  /**
   * @notice 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
   * @dev This file uses a total of 500 slots.
   */
  uint256[498] private __gap;
}

File 47 of 53 : WorldsManagement.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { IWorldsNFTMarket } from "../../interfaces/internal/IWorldsNFTMarket.sol";

import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import { SafeCast } from "@openzeppelin/contracts-v5/utils/math/SafeCast.sol";

import { WorldsAllowlistBySeller } from "./WorldsAllowlistBySeller.sol";
import { WorldsMetadata } from "./WorldsMetadata.sol";
import { WorldsPaymentInfo } from "./WorldsPaymentInfo.sol";
import { WorldsUserRoles } from "./WorldsUserRoles.sol";

/**
 * @title Allows curators to mint and burn worlds.
 * @author HardlyDifficult
 */
abstract contract WorldsManagement is
  IWorldsNFTMarket,
  WorldsUserRoles,
  WorldsMetadata,
  WorldsPaymentInfo,
  WorldsAllowlistBySeller
{
  using SafeCast for uint256;

  /// @notice The sequence id for worlds, set to the most recent World created.
  /// @dev Capping the size of this variable to 32 bits allows us to save gas by using uint32s elsewhere.
  uint32 private $latestWorldIdMinted;

  uint256 private immutable networkMaxWorldId;

  error WorldsManagement_Already_Initialized();
  error WorldsManagement_WorldId_Exceeds_Max_Network_World_Id(uint256 networkMaxWorldId);

  ////////////////////////////////////////////////////////////////
  // Setup
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Set immutable variables for the implementation contract.
   * @param _networkMaxWorldId The maximum World id that can be minted on this network.
   * It's an exclusive value - so if set to 100 this network will mint worlds with ids 1-99.
   * Deploy configuration will set this value per-network in order to ensure worldIds are always unique across chains
   * even if an absurd number of worlds are minted.
   */
  constructor(uint256 _networkMaxWorldId) {
    // Using 32-bit safe cast here even though it's stored as 256-bit integer to allow 32-bit assumptions elsewhere.
    networkMaxWorldId = _networkMaxWorldId.toUint32();
  }

  /**
   * @notice Initialize mutable variables for the contract.
   * @param networkWorldIdOffset The first world minted on this network will use `worldId = networkWorldIdOffset + 1`.
   * Deploy configuration will set this value per-network in order to ensure worldIds are always unique across chains.
   */
  function _initializeWorldsManagement(uint256 networkWorldIdOffset) internal {
    if (networkWorldIdOffset >= networkMaxWorldId) {
      revert WorldsManagement_WorldId_Exceeds_Max_Network_World_Id(networkMaxWorldId);
    }
    if ($latestWorldIdMinted != 0) {
      // Explicitly checking this here instead of leaning on initializer to be extra cautious of errors during future
      // upgrades.
      revert WorldsManagement_Already_Initialized();
    }

    $latestWorldIdMinted = networkWorldIdOffset.toUint32();
  }

  ////////////////////////////////////////////////////////////////
  // Management
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Allows a curator to mint a new World NFT.
   * @param defaultTakeRateInBasisPoints The curator's take rate for sales of curated pieces in supported marketplaces.
   * @param worldPaymentAddress The address that will receive curator payments for the World.
   * @param name The World's name.
   */
  function mint(
    uint16 defaultTakeRateInBasisPoints,
    address payable worldPaymentAddress,
    string calldata name
  ) public returns (uint256 worldId) {
    unchecked {
      // The max check below ensures that the worldId won't overflow 32 bits.
      worldId = ++$latestWorldIdMinted;
    }
    if (worldId >= networkMaxWorldId) {
      revert WorldsManagement_WorldId_Exceeds_Max_Network_World_Id(networkMaxWorldId);
    }

    _mintWorldsPaymentInfo(worldId, defaultTakeRateInBasisPoints, worldPaymentAddress);
    _mintMetadata(worldId, name);
    _safeMint(_msgSender(), worldId);
  }

  /**
   * @notice Allows a curator to mint a new World NFT and populate the seller allowlist.
   * @param defaultTakeRateInBasisPoints The curator's take rate for sales of curated pieces in supported marketplaces.
   * @param worldPaymentAddress The address that will receive curator payments for the World.
   * @param name The World's name.
   * @param sellers The list of sellers to give permissions to list with a World.
   */
  function mintWithSellerAllowlist(
    uint16 defaultTakeRateInBasisPoints,
    address payable worldPaymentAddress,
    string calldata name,
    address[] calldata sellers
  ) external returns (uint256 worldId) {
    // Checked math ensures that the worldId won't overflow 32 bits.
    worldId = mint(defaultTakeRateInBasisPoints, worldPaymentAddress, name);

    _addToAllowlistBySellers(worldId, sellers);
  }

  /**
   * @notice Allows curator to mint a World NFT & populate team. Sets defaultTakeRateInBasisPoints to 0.
   * @param worldPaymentAddress The address that will receive curator payments for the World.
   * @param name The World's name.
   * @param admins The list of admins.
   * @param editors The list of editors.
   */
  function mintWithTeam(
    address payable worldPaymentAddress,
    string calldata name,
    address[] calldata admins,
    address[] calldata editors
  ) external returns (uint256 worldId) {
    worldId = mint({ defaultTakeRateInBasisPoints: 0, worldPaymentAddress: worldPaymentAddress, name: name });
    // order of loops matters, setAdminRole() must be last as it includes editor role
    for (uint256 i = 0; i < editors.length; ++i) {
      _setEditorRole(worldId, editors[i]);
    }
    for (uint256 i = 0; i < admins.length; ++i) {
      _setAdminRole(worldId, admins[i]);
    }
  }

  /**
   * @notice Allows a curator to burn a World NFT they own.
   * @param worldId The id of the World NFT to burn.
   */
  function burn(uint256 worldId) external onlyOwner(worldId) {
    _burn(worldId);
  }

  ////////////////////////////////////////////////////////////////
  // Inheritance Requirements
  // (no-ops to avoid compile errors)
  ////////////////////////////////////////////////////////////////

  function _burn(
    uint256 tokenId
  ) internal virtual override(ERC721Upgradeable, WorldsMetadata, WorldsPaymentInfo, WorldsAllowlistBySeller) {
    super._burn(tokenId);
  }

  function supportsInterface(
    bytes4 interfaceId
  ) public view virtual override(ERC721Upgradeable, WorldsMetadata) returns (bool isSupported) {
    isSupported = super.supportsInterface(interfaceId);
  }

  function tokenURI(
    uint256 worldId
  ) public view virtual override(ERC721Upgradeable, WorldsMetadata) returns (string memory uri) {
    uri = super.tokenURI(worldId);
  }

  /**
   * @notice 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
   * @dev This file uses a total of 1,000 slots.
   */
  uint256[999] private __gap;
}

File 48 of 53 : WorldsMetadata.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { IWorldsNFTMarket } from "../../interfaces/internal/IWorldsNFTMarket.sol";

import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";

import { DelegateForwarder } from "../shared/DelegateForwarder.sol";
import { ERC4906 } from "../collections/ERC4906.sol";
import { ERC721UserRoles } from "../roles/ERC721UserRoles.sol";

import { WorldsCore } from "./WorldsCore.sol";
import { WorldsUserRoles } from "./WorldsUserRoles.sol";

/**
 * @title Defines a unique tokenURI for each World NFT.
 * @author HardlyDifficult
 */
abstract contract WorldsMetadata is
  IWorldsNFTMarket,
  DelegateForwarder,
  ERC721Upgradeable,
  ERC4906,
  ERC721UserRoles,
  WorldsCore,
  WorldsUserRoles
{
  /// @notice Stores the name of each World.
  mapping(uint256 worldId => string name) private $worldIdToName;

  uint256 private __gap_was_$svgTemplate;

  address private immutable metadataDelegate;

  error WorldsMetadata_Name_Already_Set();
  error WorldsMetadata_Name_Required();
  error WorldsMetadata_Svg_Template_Missing_WorldId_Placeholder();

  ////////////////////////////////////////////////////////////////
  // Setup
  ////////////////////////////////////////////////////////////////

  constructor(address _metadataDelegate) {
    metadataDelegate = _metadataDelegate;
  }

  /**
   * @notice Returns the contract which handles some metadata requests for Worlds.
   * @dev Passthrough to this delegate contract is transparent to users.
   */
  function getWorldsMetadataDelegateAddress() external view returns (address worldsMetadataDelegate) {
    worldsMetadataDelegate = metadataDelegate;
  }

  ////////////////////////////////////////////////////////////////
  // On Mint
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Set the metadata for a given World when that World is initially created.
   * @param worldId The World to set metadata for.
   * @param name The name of the World.
   */
  function _mintMetadata(uint256 worldId, string memory name) internal {
    if (bytes(name).length == 0) {
      revert WorldsMetadata_Name_Required();
    }

    $worldIdToName[worldId] = name;
  }

  ////////////////////////////////////////////////////////////////
  // World Name
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Allows a curator to update the tokenURI for a World NFT.
   * @param worldId The id of the World NFT to updates
   * @param name The name of the World.
   * @dev Callable by the World owner, admin, or editor.
   */
  function updateWorldName(uint256 worldId, string calldata name) external {
    worldId; // silence unused variable compiler warning
    name;

    _delegate(metadataDelegate);
  }

  /**
   * @notice Returns the name of a given World.
   */
  function getWorldName(uint256 worldId) external view returns (string memory name) {
    worldId; // silence unused variable compiler warning
    name;

    _delegateView(metadataDelegate);
  }

  ////////////////////////////////////////////////////////////////
  // ERC-721 Metadata Standard
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Returns the World's metadata JSON including an SVG image.
   * @param worldId The ID of the World.
   */
  function tokenURI(uint256 worldId) public view virtual override returns (string memory uri) {
    worldId; // silence unused variable compiler warning
    uri;

    _delegateView(metadataDelegate);
  }

  ////////////////////////////////////////////////////////////////
  // Cleanup
  ////////////////////////////////////////////////////////////////

  /// @dev Cleans up a World's metadata when it's burned.
  function _burn(uint256 worldId) internal virtual override {
    delete $worldIdToName[worldId];

    super._burn(worldId);
  }

  ////////////////////////////////////////////////////////////////
  // Inheritance Requirements
  // (no-ops to avoid compile errors)
  ////////////////////////////////////////////////////////////////

  function supportsInterface(
    bytes4 interfaceId
  ) public view virtual override(ERC4906, ERC721Upgradeable) returns (bool isSupported) {
    isSupported = super.supportsInterface(interfaceId);
  }

  /**
   * @notice 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
   * @dev This file uses a total of 1,000 slots.
   */
  uint256[998] private __gap;
}

File 49 of 53 : WorldsNotImplemented.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";

/**
 * @title Standard functions which are not currently implemented in Worlds.
 * @author HardlyDifficult & reggieag.
 */
abstract contract WorldsNotImplemented is ERC721Upgradeable {
  error WorldsNotImplemented_Function_Not_Implemented();

  /**
   * @notice [NOT IMPLEMENTED] Use `beginTransfer` instead.
   * @dev Override the default transfer behavior to prevent direct transfers.
   * Direct transfers are disabled to prevent a user from spamming a user with unwanted worlds.
   * Direct transfers will be implemented once the use-case for them becomes clear.
   */
  function safeTransferFrom(
    address /* from */,
    address /* to */,
    uint256 /* tokenId */,
    bytes memory /* data */
  ) public pure virtual override {
    revert WorldsNotImplemented_Function_Not_Implemented();
  }

  /**
   * @notice [NOT IMPLEMENTED] Use `beginTransfer` instead.
   * @dev Override the default transfer behavior to prevent direct transfers.
   * Direct transfers are disabled to prevent a user from spamming a user with unwanted worlds.
   * Direct transfers will be implemented once the use-case for them becomes clear.
   */
  function transferFrom(address /* from */, address /* to */, uint256 /* tokenId */) public pure virtual override {
    revert WorldsNotImplemented_Function_Not_Implemented();
  }
}

File 50 of 53 : WorldsPaymentInfo.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";

import { IWorldsSharedMarket } from "../../interfaces/internal/IWorldsSharedMarket.sol";

import { MAX_WORLD_TAKE_RATE } from "../shared/Constants.sol";

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

/**
 * @title Defines payment details to be used for a World.
 * @author HardlyDifficult, reggieag
 */
abstract contract WorldsPaymentInfo is IWorldsSharedMarket, ERC721Upgradeable, WorldsUserRoles {
  struct PaymentInfo {
    // Slot 0
    uint16 defaultTakeRateInBasisPoints;
    address payable worldPaymentAddress;
    // (94-bits free space)
  }

  /// @notice Stores payment details for each World.
  mapping(uint256 worldId => PaymentInfo takeRateInfo) private $worldIdToPaymentInfo;

  ////////////////////////////////////////////////////////////////
  // Events
  ////////////////////////////////////////////////////////////////

  /**
   * Emitted when the default take rate for a World is assigned.
   * @param worldId The ID of the World.
   * @param defaultTakeRateInBasisPoints The default take rate for the World, in basis points.
   */
  event DefaultTakeRateSet(uint256 indexed worldId, uint16 defaultTakeRateInBasisPoints);

  /**
   * @notice Emitted when the payment address is set.
   * @param worldId The ID of the World.
   * @param worldPaymentAddress The payment address for the World.
   */
  event PaymentAddressSet(uint256 indexed worldId, address indexed worldPaymentAddress);

  error WorldsPaymentInfo_Cannot_Set_Zero_Payment_Address();
  error WorldsPaymentInfo_Exceeds_Max_World_Take_Rate(uint256 maxTakeRate);
  error WorldsPaymentInfo_Payment_Address_Already_Set();

  ////////////////////////////////////////////////////////////////
  // Setup
  ////////////////////////////////////////////////////////////////

  /// @notice Called on mint of a new World to configure the default payment info.
  function _mintWorldsPaymentInfo(
    uint256 worldId,
    uint16 defaultTakeRateInBasisPoints,
    address payable worldPaymentAddress
  ) internal {
    if (defaultTakeRateInBasisPoints != 0) {
      _setDefaultTakeRate(worldId, defaultTakeRateInBasisPoints);
    }
    _setPaymentAddress(worldId, worldPaymentAddress);
  }

  ////////////////////////////////////////////////////////////////
  // Payment address
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Set the payment address for the World.
   * @param worldId The ID of the World to set the payment address for.
   * @param worldPaymentAddress The payment address for the World.
   */
  function setPaymentAddress(uint256 worldId, address payable worldPaymentAddress) external onlyAdmin(worldId) {
    _setPaymentAddress(worldId, worldPaymentAddress);
  }

  function _setPaymentAddress(uint256 worldId, address payable worldPaymentAddress) private {
    if (worldPaymentAddress == payable(address(0))) {
      revert WorldsPaymentInfo_Cannot_Set_Zero_Payment_Address();
    }
    if ($worldIdToPaymentInfo[worldId].worldPaymentAddress == worldPaymentAddress) {
      // Revert if the transaction is a no-op.
      revert WorldsPaymentInfo_Payment_Address_Already_Set();
    }

    $worldIdToPaymentInfo[worldId].worldPaymentAddress = worldPaymentAddress;

    emit PaymentAddressSet(worldId, worldPaymentAddress);
  }

  /**
   * @notice Get the payment address for a World.
   * @param worldId The ID of the World to get the payment address for.
   * @return worldPaymentAddress The payment address for the World.
   */
  function getPaymentAddress(uint256 worldId) public view returns (address payable worldPaymentAddress) {
    worldPaymentAddress = $worldIdToPaymentInfo[worldId].worldPaymentAddress;
  }

  ////////////////////////////////////////////////////////////////
  // Take rate
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Set default take rate for a World.
   * @param worldId ID of the World to set take rate for.
   * @param defaultTakeRateInBasisPoints default take rate for World, in basis points.
   */
  function setDefaultTakeRate(uint256 worldId, uint16 defaultTakeRateInBasisPoints) external onlyAdmin(worldId) {
    _setDefaultTakeRate(worldId, defaultTakeRateInBasisPoints);
  }

  function _setDefaultTakeRate(uint256 worldId, uint16 defaultTakeRateInBasisPoints) private {
    if (defaultTakeRateInBasisPoints > MAX_WORLD_TAKE_RATE) {
      revert WorldsPaymentInfo_Exceeds_Max_World_Take_Rate(MAX_WORLD_TAKE_RATE);
    }

    $worldIdToPaymentInfo[worldId].defaultTakeRateInBasisPoints = defaultTakeRateInBasisPoints;
    emit DefaultTakeRateSet(worldId, defaultTakeRateInBasisPoints);
  }

  /**
   * @notice Get the default take rate for a World.
   * The actual take rate applied to sales may differ per inventory item listed with a World.
   * @param worldId The ID of the World to get the default take rate for.
   * @return defaultTakeRateInBasisPoints The default take rate for the World.
   */
  function getDefaultTakeRate(uint256 worldId) public view returns (uint16 defaultTakeRateInBasisPoints) {
    defaultTakeRateInBasisPoints = $worldIdToPaymentInfo[worldId].defaultTakeRateInBasisPoints;
  }

  ////////////////////////////////////////////////////////////////
  // Cleanup
  ////////////////////////////////////////////////////////////////

  function _burn(uint256 worldId) internal virtual override {
    // When a World is burned, remove the stored payment info.
    delete $worldIdToPaymentInfo[worldId];

    super._burn(worldId);
  }

  /**
   * @notice 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
   * @dev This file uses a total of 1,000 slots.
   */
  uint256[999] private __gap;
}

File 51 of 53 : WorldsSharedTypes.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

/// @notice The approval mechanism to use to approve listing with a World.
enum ApprovalType {
  SellerAllowlist,
  AuthorizeBySignature
}

/// @notice The listing flow being used to list with a World.
enum ListingType {
  NFT,
  Collection,
  Split
}

/// @notice The action to take for a user role.
enum RoleAction {
  RevokeAllRoles,
  SetAdmin,
  SetEditor
}

/// @notice A user and the role action to take for that user.
struct UserRoleAction {
  address user;
  RoleAction roleAction;
}

File 52 of 53 : WorldsTransfer2Step.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";

import { WorldsUserRoles } from "../../mixins/worlds/WorldsUserRoles.sol";

/**
 * @title Introduces 2 step transfers for World NFTs.
 * @author reggieag
 */
abstract contract WorldsTransfer2Step is ERC721Upgradeable, WorldsUserRoles {
  /// @notice Stores the pending owner for a token ID.
  mapping(uint256 worldId => address pendingOwner) private $worldIdToPendingOwner;

  /**
   * @notice Emitted when a transfer is started or cancelled.
   * @param to The pending recipient's address.
   * When the `to address` is the zero address, this indicates that the transfer has been canceled.
   * @param worldId The ID of the token.
   */
  event BeginTransfer(address indexed to, uint256 indexed worldId);

  error WorldsTransfer2Step_Caller_Not_Token_Owner_Or_Approved();
  error WorldsTransfer2Step_Not_Pending_Owner_For_Token_Id(address pendingOwner);
  error WorldsTransfer2Step_Transfer_To_Already_Initiated();
  error WorldsTransfer2Step_Cannot_Transfer_To_Current_Owner();

  ////////////////////////////////////////////////////////////////
  // Transfer flow
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Begins a 2 step transfer by setting the pending owner. The recipient can complete the process by calling
   * `acceptTransfer`.
   * @param to The pending recipient's address.
   * To cancel a transfer for a World, call this function with the `to` set to address(0).
   * @param worldId The ID of the World to transfer.
   * @dev Callable by the World owner or an approved address.
   */
  function beginTransfer(address to, uint256 worldId) external {
    if (!_isApprovedOrOwner(_msgSender(), worldId)) {
      revert WorldsTransfer2Step_Caller_Not_Token_Owner_Or_Approved();
    }
    if ($worldIdToPendingOwner[worldId] == to) {
      revert WorldsTransfer2Step_Transfer_To_Already_Initiated();
    }
    if (to == ownerOf(worldId)) {
      revert WorldsTransfer2Step_Cannot_Transfer_To_Current_Owner();
    }

    $worldIdToPendingOwner[worldId] = to;

    emit BeginTransfer(to, worldId);
  }

  /**
   * @notice Accept a pending 2 step transfer by the pending owner, completing the transfer.
   * @param worldId The ID of the World to receive.
   * @dev The previous owner will be granted the admin user role for the World.
   */
  function acceptTransfer(uint256 worldId) external {
    address pendingOwner = $worldIdToPendingOwner[worldId];
    if (pendingOwner != _msgSender()) {
      revert WorldsTransfer2Step_Not_Pending_Owner_For_Token_Id(pendingOwner);
    }

    address previousOwner = ownerOf(worldId);
    _transfer(previousOwner, pendingOwner, worldId);

    // Grant the previous owner the admin role if they do not already have it.
    if (!hasAdminRole(worldId, previousOwner)) {
      _setAdminRole(worldId, previousOwner);
    }
  }

  /**
   * @notice Get the pending owner for a worldId.
   * @param worldId The ID of the token to transfer.
   * @return pendingOwner The pending owner which can `acceptTransfer`. Returns address(0) if no transfer is pending or
   * the token ID does not exist.
   */
  function getPendingOwner(uint256 worldId) external view returns (address pendingOwner) {
    pendingOwner = $worldIdToPendingOwner[worldId];
  }

  ////////////////////////////////////////////////////////////////
  // Cleanup
  ////////////////////////////////////////////////////////////////

  function _afterTokenTransfer(
    address from,
    address to,
    uint256 firstTokenId,
    uint256 batchSize
  ) internal virtual override {
    if (from != address(0)) {
      // Clear pending owner after a transfer or burn. This is not required on Mint since tokenIDs are not reused.
      delete $worldIdToPendingOwner[firstTokenId];
    }

    super._afterTokenTransfer(from, to, firstTokenId, batchSize);
  }

  /**
   * @notice 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
   * @dev This file uses a total of 1,000 slots.
   */
  uint256[999] private __gap;
}

File 53 of 53 : WorldsUserRoles.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { UserRoleAction, RoleAction } from "./WorldsSharedTypes.sol";

import { ERC721Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";

import { ERC721UserRoles } from "../roles/ERC721UserRoles.sol";

import { IWorldsNftUserRoles } from "../../interfaces/internal/routes/IWorldsNftUserRoles.sol";

/**
 * @title Defines ACLs for individual World NFTs.
 * @author HardlyDifficult & reggieag
 */
abstract contract WorldsUserRoles is IWorldsNftUserRoles, ERC721Upgradeable, ERC721UserRoles {
  enum Roles {
    ADMIN,
    EDITOR
    // Additional roles may be added in the future, append only.
  }

  /**
   * @notice Emitted when an admin role is set for a World and a user.
   * @param worldId The ID of the World.
   * @param user The address of the user that is granted an admin role.
   * @dev All existing roles are overwritten.
   */
  event AdminRoleSet(uint256 indexed worldId, address indexed user);

  /**
   * @notice Emitted when an editor role is set for a World and a user.
   * @param worldId The ID of the World.
   * @param user The address of the user that is granted and editor role.
   * @dev All existing roles are overwritten.
   */
  event EditorRoleSet(uint256 indexed worldId, address indexed user);

  error WorldsUserRoles_Sender_Does_Not_Have_Admin_User_Role();
  error WorldsUserRoles_Sender_Does_Not_Have_Editor_User_Role();
  error WorldsUserRoles_Sender_Is_Not_World_Owner();
  error WorldsUserRoles_No_User_Role_Actions();

  ////////////////////////////////////////////////////////////////
  // Owner
  ////////////////////////////////////////////////////////////////

  /// @dev Requires that the caller is the owner of the specified World.
  modifier onlyOwner(uint256 worldId) {
    if (ownerOf(worldId) != _msgSender()) {
      revert WorldsUserRoles_Sender_Is_Not_World_Owner();
    }
    _;
  }

  ////////////////////////////////////////////////////////////////
  // Batch updates
  ////////////////////////////////////////////////////////////////

  /**
   * Manages user roles for a world in bulk.
   * The caller can set an editor role, or an admin role, or revoke all roles for a user.
   * The `RoleAction` enum is used to specify the action to take for each user.
   * @param worldId The address of the NFT contract.
   * @param userRoleActions The user addresses and the role actions to take for that user.
   * @dev Notes:
   *   a) The caller of this function must have an admin role or be the owner of the world.
   *   b) Cannot set a role for a user if they already have that same role granted. For example, cannot set
   *      an editor role for a user if they already have an editor role.
   */
  function manageRolesForUsers(uint256 worldId, UserRoleAction[] calldata userRoleActions) external onlyAdmin(worldId) {
    if (userRoleActions.length == 0) {
      revert WorldsUserRoles_No_User_Role_Actions();
    }

    for (uint256 i = 0; i < userRoleActions.length; ++i) {
      if (userRoleActions[i].roleAction == RoleAction.RevokeAllRoles) {
        _revokeAllRolesForUser(worldId, userRoleActions[i].user);
      } else if (userRoleActions[i].roleAction == RoleAction.SetAdmin) {
        _setAdminRole(worldId, userRoleActions[i].user);
      } else {
        // if (userRoleActions[i].roleAction == RoleAction.SetEditor)
        _setEditorRole(worldId, userRoleActions[i].user);
      }
    }
  }

  ////////////////////////////////////////////////////////////////
  // Admin
  ////////////////////////////////////////////////////////////////

  /// @dev Requires that the caller has admin permissions for the specified World.
  modifier onlyAdmin(uint256 worldId) {
    if (!hasAdminRole(worldId, _msgSender())) {
      revert WorldsUserRoles_Sender_Does_Not_Have_Admin_User_Role();
    }
    _;
  }

  /**
   * @notice Sets an admin role for a World and a user.
   * @param worldId The ID of the World.
   * @param user The address of the user that is granted an admin role.
   * @dev Callable by the World owner or admin. Any existing roles for this user are overwritten.
   */
  function setAdminRole(uint256 worldId, address user) external onlyAdmin(worldId) {
    _setAdminRole(worldId, user);
  }

  function _setAdminRole(uint256 worldId, address user) internal {
    _setUserRole(worldId, user, uint8(Roles.ADMIN));
    emit AdminRoleSet(worldId, user);
  }

  /**
   * @notice Returns true if a user has an admin role granted for a World.
   * @param worldId The ID of the World.
   * @param user The address of the user to check for an admin role.
   * @dev Admin permissions are implicitly granted to the owner.
   */
  function hasAdminRole(uint256 worldId, address user) public view returns (bool hasRole) {
    hasRole = ownerOf(worldId) == user || _hasUserRole(worldId, user, uint8(Roles.ADMIN));
  }

  ////////////////////////////////////////////////////////////////
  // Editor
  ////////////////////////////////////////////////////////////////

  /// @dev Requires that the caller has editor permissions for the specified World.
  modifier onlyEditor(uint256 worldId) {
    if (!hasEditorRole(worldId, _msgSender())) {
      revert WorldsUserRoles_Sender_Does_Not_Have_Editor_User_Role();
    }
    _;
  }

  /**
   * @notice Sets an editor role for a World and a user.
   * @param worldId The ID of the World.
   * @param user The address of the user that is granted an admin role.
   * @dev Callable by the World owner or admin. Any existing roles for this user are overwritten.
   */
  function setEditorRole(uint256 worldId, address user) external onlyAdmin(worldId) {
    _setEditorRole(worldId, user);
  }

  function _setEditorRole(uint256 worldId, address user) internal {
    _setUserRole(worldId, user, uint8(Roles.EDITOR));

    emit EditorRoleSet(worldId, user);
  }

  /**
   * @notice Returns true if a user has an editor role granted for a World.
   * @param worldId The ID of the World.
   * @param user The address of the user to check for an editor role.
   * @dev Editor permissions are implicitly granted to the owner and admin user roles.
   */
  function hasEditorRole(uint256 worldId, address user) public view returns (bool hasRole) {
    hasRole = hasAdminRole(worldId, user) || _hasUserRole(worldId, user, uint8(Roles.EDITOR));
  }

  ////////////////////////////////////////////////////////////////
  // Removing roles
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Allows the caller to their current role within a World.
   * @param worldId The ID of the World.
   */
  function renounceAllRoles(uint256 worldId) external {
    _revokeAllRolesForUser(worldId, _msgSender());
  }

  /**
   * @notice Revokes all roles for a World and a user.
   * @param worldId The ID of the World.
   * @param user The address of the user whose roles are being revoked.
   * @dev Callable by the World owner or admin.
   */
  function revokeAllRolesForUser(uint256 worldId, address user) external onlyAdmin(worldId) {
    _revokeAllRolesForUser(worldId, user);
  }

  /**
   * @notice 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
   * @dev This file uses a total of 800 slots.
   */
  uint256[800] private __gap;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"components":[{"internalType":"address","name":"worldsProxyAddress","type":"address"},{"internalType":"address","name":"routerContext1","type":"address"},{"internalType":"address","name":"routerContext2","type":"address"},{"internalType":"address","name":"splitTemplate","type":"address"},{"internalType":"address","name":"trustedSigner","type":"address"},{"internalType":"uint256","name":"maxWorldId","type":"uint256"}],"internalType":"struct Worlds.WorldsConstructorParams","name":"constructorParams","type":"tuple"},{"internalType":"address","name":"worldsMetadataDelegate","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DelegateForwarder_For_Internal_Use_Only","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"EIP712_Invalid_Signer","type":"error"},{"inputs":[],"name":"ERC1167FailedCreateClone","type":"error"},{"inputs":[],"name":"ERC721UserRoles_User_Has_No_Roles","type":"error"},{"inputs":[],"name":"ERC721UserRoles_User_Must_Not_Be_Zero_Address","type":"error"},{"inputs":[],"name":"ERC721UserRoles_User_Role_Already_Set","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"uint8","name":"bits","type":"uint8"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"SafeCastOverflowedUintDowncast","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"inputs":[],"name":"WorldsAllowlistBySeller_Address_0_May_Not_Be_Added","type":"error"},{"inputs":[],"name":"WorldsAllowlistBySeller_No_Sellers_Provided","type":"error"},{"inputs":[],"name":"WorldsAllowlistBySeller_Seller_Already_On_Allowlist","type":"error"},{"inputs":[],"name":"WorldsAllowlistBySeller_Seller_Not_Allowed","type":"error"},{"inputs":[{"internalType":"uint16","name":"minimumTakeRateInBasisPoints","type":"uint16"}],"name":"WorldsAllowlistBySeller_Take_Rate_Too_Low","type":"error"},{"inputs":[],"name":"WorldsAllowlistBySignature_Invalid_Approval_Type","type":"error"},{"inputs":[],"name":"WorldsAllowlistBySignature_Signer_Is_Required","type":"error"},{"inputs":[],"name":"WorldsAllowlistBySignature_Tx_Deadline_Expired","type":"error"},{"inputs":[{"internalType":"uint256","name":"maxExpiration","type":"uint256"}],"name":"WorldsAllowlistBySignature_Tx_Deadline_Too_Far_In_Future","type":"error"},{"inputs":[],"name":"WorldsAllowlist_List_Type_Does_Not_Support_Listing_Identifier","type":"error"},{"inputs":[{"internalType":"uint256","name":"maxTakeRate","type":"uint256"}],"name":"WorldsAllowlist_Take_Rate_Above_Max","type":"error"},{"inputs":[],"name":"WorldsInventoryByNft_Not_In_A_World","type":"error"},{"inputs":[],"name":"WorldsInventoryBySplit_Not_A_Valid_Split","type":"error"},{"inputs":[],"name":"WorldsInventoryBySplit_Not_Listed_In_A_World","type":"error"},{"inputs":[],"name":"WorldsInventoryBySplit_Split_Implementation_Not_A_Contract","type":"error"},{"inputs":[],"name":"WorldsManagement_Already_Initialized","type":"error"},{"inputs":[{"internalType":"uint256","name":"networkMaxWorldId","type":"uint256"}],"name":"WorldsManagement_WorldId_Exceeds_Max_Network_World_Id","type":"error"},{"inputs":[],"name":"WorldsMetadata_Name_Already_Set","type":"error"},{"inputs":[],"name":"WorldsMetadata_Name_Required","type":"error"},{"inputs":[],"name":"WorldsMetadata_Svg_Template_Missing_WorldId_Placeholder","type":"error"},{"inputs":[],"name":"WorldsNotImplemented_Function_Not_Implemented","type":"error"},{"inputs":[],"name":"WorldsPaymentInfo_Cannot_Set_Zero_Payment_Address","type":"error"},{"inputs":[{"internalType":"uint256","name":"maxTakeRate","type":"uint256"}],"name":"WorldsPaymentInfo_Exceeds_Max_World_Take_Rate","type":"error"},{"inputs":[],"name":"WorldsPaymentInfo_Payment_Address_Already_Set","type":"error"},{"inputs":[],"name":"WorldsTransfer2Step_Caller_Not_Token_Owner_Or_Approved","type":"error"},{"inputs":[],"name":"WorldsTransfer2Step_Cannot_Transfer_To_Current_Owner","type":"error"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"WorldsTransfer2Step_Not_Pending_Owner_For_Token_Id","type":"error"},{"inputs":[],"name":"WorldsTransfer2Step_Transfer_To_Already_Initiated","type":"error"},{"inputs":[],"name":"WorldsUserRoles_No_User_Role_Actions","type":"error"},{"inputs":[],"name":"WorldsUserRoles_Sender_Does_Not_Have_Admin_User_Role","type":"error"},{"inputs":[],"name":"WorldsUserRoles_Sender_Does_Not_Have_Editor_User_Role","type":"error"},{"inputs":[],"name":"WorldsUserRoles_Sender_Is_Not_World_Owner","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"seller","type":"address"}],"name":"AddToAllowlistBySeller","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"},{"indexed":false,"internalType":"string","name":"listingIdentifier","type":"string"}],"name":"AddToWorldByCollection","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftTokenId","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"},{"indexed":false,"internalType":"string","name":"listingIdentifier","type":"string"}],"name":"AddToWorldByNft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"address","name":"split","type":"address"},{"indexed":false,"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"},{"indexed":false,"internalType":"string","name":"listingIdentifier","type":"string"}],"name":"AddToWorldBySplit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"AdminRoleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"}],"name":"BeginTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"defaultTakeRateInBasisPoints","type":"uint16"}],"name":"DefaultTakeRateSet","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"EditorRoleSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"MetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"worldPaymentAddress","type":"address"}],"name":"PaymentAddressSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"seller","type":"address"}],"name":"RemoveFromAllowlistBySeller","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":true,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftTokenId","type":"uint256"}],"name":"RemoveFromWorldByNft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"marketplace","type":"address"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalSalePrice","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"}],"name":"SoldInWorldByCollection","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"marketplace","type":"address"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"nftContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"nftTokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"uint256","name":"salePrice","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"}],"name":"SoldInWorldByNft","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"marketplace","type":"address"},{"indexed":true,"internalType":"address","name":"split","type":"address"},{"indexed":false,"internalType":"uint256","name":"valueInWei","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"curatorTakeInWei","type":"uint256"}],"name":"SoldInWorldBySplit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"worldId","type":"uint256"},{"indexed":true,"internalType":"address","name":"marketplace","type":"address"},{"indexed":true,"internalType":"address","name":"split","type":"address"},{"indexed":false,"internalType":"address","name":"worldPaymentAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"valueInWei","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"curatorTakeInWei","type":"uint256"}],"name":"SoldInWorldBySplitWorldPaymentFailed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"user","type":"address"}],"name":"UserRolesRevoked","type":"event"},{"inputs":[],"name":"_delegateView","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"}],"name":"acceptTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"seller","type":"address"}],"name":"addToAllowlistBySeller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address[]","name":"sellers","type":"address[]"}],"name":"addToAllowlistBySellers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"}],"name":"addToWorldByCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"},{"internalType":"bytes","name":"approvalData","type":"bytes"}],"name":"addToWorldByCollectionV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"nftTokenId","type":"uint256"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"}],"name":"addToWorldByNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"nftTokenId","type":"uint256"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"},{"internalType":"bytes","name":"approvalData","type":"bytes"}],"name":"addToWorldByNftV2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"},{"internalType":"address payable","name":"creatorPaymentAddress","type":"address"}],"name":"addToWorldBySplit","outputs":[{"internalType":"address payable","name":"split","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"},{"internalType":"address payable","name":"creatorPaymentAddress","type":"address"},{"internalType":"bytes","name":"approvalData","type":"bytes"}],"name":"addToWorldBySplitV2","outputs":[{"internalType":"address payable","name":"split","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"worldId","type":"uint256"}],"name":"beginTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getApprovedRouterAddresses","outputs":[{"internalType":"address","name":"routerA","type":"address"},{"internalType":"address","name":"routerB","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"address","name":"seller","type":"address"}],"name":"getAssociationByCollection","outputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"nftTokenId","type":"uint256"},{"internalType":"address","name":"seller","type":"address"}],"name":"getAssociationByNft","outputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"address","name":"seller","type":"address"}],"name":"getAssociationBySplit","outputs":[{"internalType":"address payable","name":"split","type":"address"},{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"split","type":"address"}],"name":"getAssociationBySplitAddress","outputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"}],"name":"getDefaultTakeRate","outputs":[{"internalType":"uint16","name":"defaultTakeRateInBasisPoints","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"}],"name":"getPaymentAddress","outputs":[{"internalType":"address payable","name":"worldPaymentAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"}],"name":"getPendingOwner","outputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTrustedSignerAddress","outputs":[{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"}],"name":"getWorldName","outputs":[{"internalType":"string","name":"name","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWorldSplitTemplateAddress","outputs":[{"internalType":"address","name":"worldSplitTemplate","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWorldsMetadataDelegateAddress","outputs":[{"internalType":"address","name":"worldsMetadataDelegate","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"hasAdminRole","outputs":[{"internalType":"bool","name":"hasRole","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"hasEditorRole","outputs":[{"internalType":"bool","name":"hasRole","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"networkWorldIdOffset","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"seller","type":"address"}],"name":"isSellerAllowed","outputs":[{"internalType":"bool","name":"isAllowed","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"enum RoleAction","name":"roleAction","type":"uint8"}],"internalType":"struct UserRoleAction[]","name":"userRoleActions","type":"tuple[]"}],"name":"manageRolesForUsers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"defaultTakeRateInBasisPoints","type":"uint16"},{"internalType":"address payable","name":"worldPaymentAddress","type":"address"},{"internalType":"string","name":"name","type":"string"}],"name":"mint","outputs":[{"internalType":"uint256","name":"worldId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"defaultTakeRateInBasisPoints","type":"uint16"},{"internalType":"address payable","name":"worldPaymentAddress","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"address[]","name":"sellers","type":"address[]"}],"name":"mintWithSellerAllowlist","outputs":[{"internalType":"uint256","name":"worldId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"worldPaymentAddress","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"address[]","name":"admins","type":"address[]"},{"internalType":"address[]","name":"editors","type":"address[]"}],"name":"mintWithTeam","outputs":[{"internalType":"uint256","name":"worldId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"seller","type":"address"}],"name":"removeFromAllowlistBySeller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"nftTokenId","type":"uint256"}],"name":"removeFromWorldByNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"}],"name":"renounceAllRoles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"revokeAllRolesForUser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"setAdminRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"uint16","name":"defaultTakeRateInBasisPoints","type":"uint16"}],"name":"setDefaultTakeRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"setEditorRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address payable","name":"worldPaymentAddress","type":"address"}],"name":"setPaymentAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"},{"internalType":"uint256","name":"totalSalePrice","type":"uint256"}],"name":"soldInWorldByCollection","outputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address payable","name":"worldPaymentAddress","type":"address"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"nftContract","type":"address"},{"internalType":"uint256","name":"nftTokenId","type":"uint256"},{"internalType":"address","name":"buyer","type":"address"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"soldInWorldByNft","outputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"address payable","name":"worldPaymentAddress","type":"address"},{"internalType":"uint16","name":"takeRateInBasisPoints","type":"uint16"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"valueInWei","type":"uint256"}],"name":"soldInWorldBySplit","outputs":[{"internalType":"address payable","name":"worldPaymentAddress","type":"address"},{"internalType":"uint256","name":"curatorTakeInWei","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"valueInWei","type":"uint256"}],"name":"soldInWorldBySplitWorldPaymentFailed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"isSupported","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"uri","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"worldId","type":"uint256"},{"internalType":"string","name":"name","type":"string"}],"name":"updateWorldName","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561000f575f80fd5b5060043610610388575f3560e01c8063718522aa116101df578063b4a0f56f11610109578063d7d87a2b116100a9578063f0294f4b11610079578063f0294f4b146109f1578063f90e8ac314610a04578063fd2eab6914610a2a578063fe4b84df14610a3d575f80fd5b8063d7d87a2b14610970578063e3faf50414610983578063e4650e8e14610996578063e985e9c5146109a9575f80fd5b8063c87b56dd116100e4578063c87b56dd14610924578063cb97397c14610937578063cec32ca51461094a578063d5adf4891461095d575f80fd5b8063b4a0f56f146108eb578063b88d4fde146108fe578063c5b2486914610911575f80fd5b80638abf92c91161017f57806395d89b411161014f57806395d89b4114610897578063a22cb4651461089f578063ae3a4253146108b2578063af44422c146108d8575f80fd5b80638abf92c9146107fc5780638c59fb73146108335780638f40f3781461085957806393251fba14610884575f80fd5b80637a1b2490116101ba5780637a1b249014610787578063844b71a31461079a57806384b0196e146107a2578063865a2f0f146107bd575f80fd5b8063718522aa1461068c57806372215bea146106e0578063724ef5011461074b575f80fd5b80632c1e9006116102c057806340ef10b81161026057806363a74d601161023057806363a74d601461064057806368b16b3f14610653578063691aa51a1461066657806370a0823114610679575f80fd5b806340ef10b8146105f457806342842e0e1461060757806342966c681461061a5780636352211e1461062d575f80fd5b806332ac730f1161029b57806332ac730f146105645780633695f6071461057757806339fa3f48146105985780633b60d097146105ab575f80fd5b80632c1e9006146104d45780632d4f2b01146104e7578063322178211461051d575f80fd5b8063095f0c701161032b57806323b872dd1161030657806323b872dd1461048857806324ee18851461049b578063274fae7c146104ae5780632855aa4e146104c1575f80fd5b8063095f0c701461044f578063140e6a0914610462578063200776bc14610475575f80fd5b806306fdde031161036657806306fdde0314610401578063081812fc14610416578063090d18b314610429578063095ea7b31461043c575f80fd5b806301ffc9a71461038c57806305d8d4f2146103b457806306fa1d50146103c9575b5f80fd5b61039f61039a366004615065565b610a50565b60405190151581526020015b60405180910390f35b6103c76103c23660046150a1565b610a60565b005b6103dc6103d736600461511e565b610ab2565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016103ab565b610409610aed565b6040516103ab9190615207565b6103dc610424366004615219565b610b7d565b6103c76104373660046150a1565b610baf565b6103c761044a366004615230565b610bfc565b6103c761045d3660046150a1565b610da6565b6103c761047036600461525a565b610df3565b61039f6104833660046150a1565b610e7d565b6103c7610496366004615295565b610ee3565b6103c76104a9366004615230565b610eee565b6103c76104bc366004615219565b610f6a565b6103c76104cf3660046152d3565b611042565b6103c76104e2366004615219565b611077565b6103dc6104f5366004615219565b5f908152616a0f602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b61053061052b36600461533f565b61108b565b6040805193845273ffffffffffffffffffffffffffffffffffffffff909216602084015261ffff16908201526060016103ab565b61039f6105723660046150a1565b6111bc565b61058a6105853660046153d7565b61121e565b6040519081526020016103ab565b6103c76105a6366004615452565b611242565b6105be6105b936600461548e565b611278565b6040805173ffffffffffffffffffffffffffffffffffffffff9094168452602084019290925261ffff16908201526060016103ab565b6103c76106023660046150a1565b61139b565b6103c7610615366004615295565b6113e8565b6103c7610628366004615219565b611402565b6103dc61063b366004615219565b611484565b6103c761064e3660046154ba565b61150f565b6103c7610661366004615230565b611596565b6103c76106743660046150a1565b611725565b61058a6106873660046154ff565b611772565b61069f61069a3660046154ff565b61183e565b6040516103ab949392919093845273ffffffffffffffffffffffffffffffffffffffff92831660208501529116604083015261ffff16606082015260800190565b6040805173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000cda72070e455bb31c7690a170224ce43623d0b6f811682527f000000000000000000000000762340b8a40cdd5bfc3edd94265899fda345d0e3166020820152016103ab565b6103dc610759366004615219565b5f908152612f77602052604090205462010000900473ffffffffffffffffffffffffffffffffffffffff1690565b6103c761079536600461551a565b611928565b6103c7611acd565b6107aa611b70565b6040516103ab9796959493929190615592565b6107d06107cb366004615230565b611c10565b6040805173ffffffffffffffffffffffffffffffffffffffff90931683526020830191909152016103ab565b61082061080a366004615219565b5f908152612f77602052604090205461ffff1690565b60405161ffff90911681526020016103ab565b7f000000000000000000000000e81771b732e623ae1b7e09f72c09f8c300378b206103dc565b61086c610867366004615652565b611c82565b6040805192835261ffff9091166020830152016103ab565b6103c7610892366004615230565b611d55565b610409611e7c565b6103c76108ad366004615691565b611e8b565b7f000000000000000000000000da95fd26d92fe4b4730c3367a8b13cc5ca0906d36103dc565b6103c76108e63660046156c1565b611e9d565b6104096108f9366004615219565b611ec6565b6103c761090c3660046157c7565b611ef6565b6103c761091f366004615842565b611f08565b610409610932366004615219565b611f90565b6103dc61094536600461587d565b611f9b565b6105306109583660046158cb565b612026565b61058a61096b36600461590e565b61213e565b6103c761097e36600461596d565b612256565b61086c61099136600461548e565b6122a3565b61058a6109a4366004615997565b612340565b61039f6109b736600461548e565b73ffffffffffffffffffffffffffffffffffffffff9182165f908152606a6020908152604080832093909416825291909152205460ff1690565b61039f6109ff3660046150a1565b6123d6565b7f00000000000000000000000037669abc021355f8b271fe60d67765e1fbe27ada6103dc565b6103c7610a383660046150a1565b61241f565b6103c7610a4b366004615219565b612551565b5f610a5a82612708565b92915050565b81610a6d816109ff612712565b610aa3576040517fb730a3eb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610aad8383612720565b505050565b5f80610abc612712565b90505f610ad089838a5f8b60028b8b6127f6565b9050610ae089838a8a8a8661287c565b9998505050505050505050565b606060658054610afc90615a3c565b80601f0160208091040260200160405190810160405280929190818152602001828054610b2890615a3c565b8015610b735780601f10610b4a57610100808354040283529160200191610b73565b820191905f5260205f20905b815481529060010190602001808311610b5657829003601f168201915b5050505050905090565b5f610b8782612dad565b505f9081526069602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b81610bbc816109ff612712565b610bf2576040517fb730a3eb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610aad8383612e37565b5f610c0682611484565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610cc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16610ce7612712565b73ffffffffffffffffffffffffffffffffffffffff161480610d105750610d10816109b7612712565b610d9c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610cbf565b610aad8383612f70565b81610db3816109ff612712565b610de9576040517fb730a3eb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610aad838361300f565b8281610dfe82612dad565b6113888161ffff161115610e42576040517f9a5b7c1b0000000000000000000000000000000000000000000000000000000081526113886004820152602401610cbf565b610e548282610e4f612712565b613060565b610e7685610e60612712565b868660405180602001604052805f815250613137565b5050505050565b5f610e8883836123d6565b80610edc5750610edc838360015b5f928352609760209081526040808520858052825280852073ffffffffffffffffffffffffffffffffffffffff9094168552929052912054600160ff9092161c16151590565b9392505050565b610aad83838361320b565b5f805f610efa8461323d565b6040805173ffffffffffffffffffffffffffffffffffffffff8085168252602082018a9052918101839052939650919450925033919087169085907fa7e3741a0b4c9ccc7effed91a2572c1274703b3c573e2079b5963171de00b107906060015b60405180910390a45050505050565b5f818152616a0f602052604090205473ffffffffffffffffffffffffffffffffffffffff16610f97612712565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611013576040517f1a065e4200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610cbf565b5f61101d83611484565b905061102a81838561335f565b61103483826123d6565b610aad57610aad838261300f565b5f61104b612712565b90505f61105f8783885f8960018a8a6127f6565b905061106e8783888885613137565b50505050505050565b61108881611083612712565b612720565b50565b73ffffffffffffffffffffffffffffffffffffffff8086165f90815261623f60209081526040808320938816835292815282822086835290529081205463ffffffff16908082156111b1575f838152612f77602052604090205462010000900473ffffffffffffffffffffffffffffffffffffffff16915081611113575f92505f91506111b1565b5073ffffffffffffffffffffffffffffffffffffffff8781165f81815261623f602090815260408083208b86168085529083528184208b85528352928190205481519384529183018a9052938816828501526060820187905261ffff64010000000090910416608082018190529251339186917f04224969448af01888ee9b82ab14d1cf761cc9aacf7a51195e63d512a7a8149b9181900360a00190a45b955095509592505050565b5f8281526067602052604081205473ffffffffffffffffffffffffffffffffffffffff1615610a5a57505f91825261335f6020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b5f61122b8787878761213e565b9050611238818484613661565b9695505050505050565b5f61124b612712565b90505f61125e88838989895f8a8a6127f6565b905061126e8883898989866136a3565b5050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8082165f90815261604b602090815260408083208685168452909152812054909116908082156113945773ffffffffffffffffffffffffffffffffffffffff83165f90815261604c602052604081205463ffffffff74010000000000000000000000000000000000000000909104169250611329835f9081526067602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614611390575073ffffffffffffffffffffffffffffffffffffffff82165f90815261604c60205260409020547801000000000000000000000000000000000000000000000000900461ffff16611394565b5f91505b9250925092565b816113a881610483612712565b6113de576040517f9925908400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610aad8383613842565b610aad83838360405180602001604052805f815250611ef6565b8061140b612712565b73ffffffffffffffffffffffffffffffffffffffff1661142a82611484565b73ffffffffffffffffffffffffffffffffffffffff1614611477576040517f92c311b100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114808261396a565b5050565b5f8181526067602052604081205473ffffffffffffffffffffffffffffffffffffffff1680610a5a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610cbf565b838161151a82612dad565b6113888161ffff16111561155e576040517f9a5b7c1b0000000000000000000000000000000000000000000000000000000081526113886004820152602401610cbf565b61156b8282610e4f612712565b61158e86611577612712565b87878760405180602001604052805f8152506136a3565b505050505050565b6115a76115a1612712565b82613973565b6115dd576040517f62272c1f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f818152616a0f602052604090205473ffffffffffffffffffffffffffffffffffffffff80841691160361163d576040517fdef5088a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61164681611484565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036116aa576040517ffd461d2300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f818152616a0f602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616908117909155905183927fca67ac802f4ee7e410b499c4141b330c34c3cb8c16186c36ab8e8e1dee87c00191a35050565b81611732816109ff612712565b611768576040517fb730a3eb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610aad8383613a30565b5f73ffffffffffffffffffffffffffffffffffffffff8216611816576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610cbf565b5073ffffffffffffffffffffffffffffffffffffffff165f9081526068602052604090205490565b73ffffffffffffffffffffffffffffffffffffffff81165f90815261604c60205260408120805463ffffffff7401000000000000000000000000000000000000000090910416919081908190816118b6865f9081526067602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff161461191c578054600182015473ffffffffffffffffffffffffffffffffffffffff80831696501693507801000000000000000000000000000000000000000000000000900461ffff169150611920565b5f94505b509193509193565b82611935816109ff612712565b61196b576040517fb730a3eb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8290036119a5576040517fd50d239000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b82811015610e76575f8484838181106119c2576119c2615aba565b90506040020160200160208101906119da9190615ae7565b60028111156119eb576119eb615a8d565b03611a2157611a1c85858584818110611a0657611a06615aba565b61108392602060409092020190810191506154ff565b611ac5565b6001848483818110611a3557611a35615aba565b9050604002016020016020810190611a4d9190615ae7565b6002811115611a5e57611a5e615a8d565b03611a9457611a1c85858584818110611a7957611a79615aba565b611a8f92602060409092020190810191506154ff565b61300f565b611ac585858584818110611aaa57611aaa615aba565b611ac092602060409092020190810191506154ff565b613a30565b6001016119a7565b333014611b06576040517feab5a03f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe836018060045f375f80825f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c5af490503d5f803e808015611b6c573d5ff35b3d5ffd5b5f6060805f805f6060611ba27f576f726c64730000000000000000000000000000000000000000000000000006613a82565b611bcb7f3100000000000000000000000000000000000000000000000000000000000001613a82565b604080515f808252602082019092527f0f000000000000000000000000000000000000000000000000000000000000009b939a50919850469750309650945092509050565b5f805f611c1c8461323d565b6040805188815260208101839052929650909450919250339173ffffffffffffffffffffffffffffffffffffffff88169184917fa89bd13a0c7d13b451ac594826a0ae0852a3cee796872087c3fe4ef607271203910160405180910390a4509250929050565b73ffffffffffffffffffffffffffffffffffffffff8082165f90815261623f60209081526040808320938716835292815282822085835290529081205463ffffffff16908115801590611cf757505f8281526067602052604090205473ffffffffffffffffffffffffffffffffffffffff1615155b15611d49575073ffffffffffffffffffffffffffffffffffffffff8281165f90815261623f60209081526040808320938816835292815282822086835290522054640100000000900461ffff16611d4d565b5f91505b935093915050565b5f611d5e612712565b73ffffffffffffffffffffffffffffffffffffffff8082165f90815261623f60209081526040808320938816835292815282822086835290529081205491925063ffffffff90911690819003611de0576040517f693ab87c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8281165f81815261623f6020908152604080832094891680845294825280832088845282529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000169055905186815284917f0e2d557782991164095499aab37a3d8177adfb1f97fce0a12f8d7b49466336b3910160405180910390a450505050565b606060668054610afc90615a3c565b611480611e96612712565b8383613abf565b610aad7f000000000000000000000000da95fd26d92fe4b4730c3367a8b13cc5ca0906d3613beb565b6060611ef17f000000000000000000000000da95fd26d92fe4b4730c3367a8b13cc5ca0906d3613c05565b919050565b611f028484848461320b565b50505050565b82611f1581610483612712565b611f4b576040517f9925908400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f829003611f85576040517ff12c846f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611f02848484613661565b6060610a5a82613cc8565b5f8483611fa782612dad565b6113888161ffff161115611feb576040517f9a5b7c1b0000000000000000000000000000000000000000000000000000000081526113886004820152602401610cbf565b611ff88282610e4f612712565b61201b87612004612712565b88888860405180602001604052805f81525061287c565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff8085165f908152615e576020908152604080832093871683529290529081205463ffffffff1690808215612134575f838152612f77602052604090205462010000900473ffffffffffffffffffffffffffffffffffffffff169150816120a6575f92505f9150612134565b5073ffffffffffffffffffffffffffffffffffffffff8681165f818152615e5760209081526040808320948a1680845294825291829020548251948552908401889052908301869052640100000000900461ffff166060830181905291339085907e516abd10b395e6c97f8299bd4a334d6b6e95b4be5c2b31f1ae4cd5bae072499060800160405180910390a45b9450945094915050565b616627805463ffffffff808216600101167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000090911681179091557f000000000000000000000000000000000000000000000000000000000098968081106121f3576040517f0143c8d30000000000000000000000000000000000000000000000000000000081527f00000000000000000000000000000000000000000000000000000000009896806004820152602401610cbf565b6121fe818686613cd3565b61223d8184848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250613cf192505050565b61224e612248612712565b82613d43565b949350505050565b81612263816109ff612712565b612299576040517fb730a3eb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610aad8383613d5c565b73ffffffffffffffffffffffffffffffffffffffff8181165f908152615e5760209081526040808320868516845282528083205463ffffffff16808452606790925282205490921615612335575073ffffffffffffffffffffffffffffffffffffffff8281165f908152615e576020908152604080832093871683529290522054640100000000900461ffff16612339565b5f91505b9250929050565b5f61234d5f89898961213e565b90505f5b8281101561238c576123848285858481811061236f5761236f615aba565b9050602002016020810190611ac091906154ff565b600101612351565b505f5b848110156123ca576123c2828787848181106123ad576123ad615aba565b9050602002016020810190611a8f91906154ff565b60010161238f565b50979650505050505050565b5f8173ffffffffffffffffffffffffffffffffffffffff166123f784611484565b73ffffffffffffffffffffffffffffffffffffffff161480610edc5750610edc83835f610e96565b8161242c81610483612712565b612462576040517f9925908400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f83815261335f6020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091529020805460ff166124cc576040517f090daa9100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f84815261335f6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551909186917f49e43845376b004b5c6ea76194d6de04333118e0f6c9c068f657d3a32cc5b33a9190a350505050565b5f54600290610100900460ff1615801561257157505f5460ff8083169116105b6125fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610cbf565b5f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001660ff831617610100179055604080518082018252600681527f576f726c647300000000000000000000000000000000000000000000000000006020808301919091528251808401909352600583527f574f524c440000000000000000000000000000000000000000000000000000009083015261269e91613e17565b6126a782613ec6565b5f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b5f610a5a82613fc4565b5f61271b613fce565b905090565b5f828152609760209081526040808320838052825280832073ffffffffffffffffffffffffffffffffffffffff85168452909152812054900361278f576040517f74f8519400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f828152609760209081526040808320838052825280832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832083905551909184917f15b346905c3358a4c6206e8d53796ff94c13e1acfeb566d58ba34274033fe78a9190a35050565b606061280189612dad565b6113888561ffff161115612845576040517f9a5b7c1b0000000000000000000000000000000000000000000000000000000081526113886004820152602401610cbf565b5f82900361285d5761285889868a613060565b612870565b61286d8989898989898989614091565b90505b98975050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8086165f90815261604b60209081526040808320888516845290915290205416801580159061298c57508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561291b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061293f9190615b05565b73ffffffffffffffffffffffffffffffffffffffff16148061298c57508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b15612a545761299a8761422f565b73ffffffffffffffffffffffffffffffffffffffff82165f90815261604c6020526040902080547fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000063ffffffff93909316929092027fffffffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffff1691909117780100000000000000000000000000000000000000000000000061ffff871602179055612d39565b73ffffffffffffffffffffffffffffffffffffffff811615612ae55773ffffffffffffffffffffffffffffffffffffffff81165f90815261604c6020526040902080547fffffffffffff000000000000000000000000000000000000000000000000000016815560010180547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b612b247f000000000000000000000000e81771b732e623ae1b7e09f72c09f8c300378b2073ffffffffffffffffffffffffffffffffffffffff1661427c565b6040517fc4d66de800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301529192509082169063c4d66de8906024015f604051808303815f87803b158015612b8e575f80fd5b505af1158015612ba0573d5f803e3d5ffd5b5050505073ffffffffffffffffffffffffffffffffffffffff8681165f90815261604b602090815260408083208985168085529083529281902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016948616949094179093558251608081019093529082528101612c1f8961422f565b63ffffffff908116825261ffff87811660208085019190915273ffffffffffffffffffffffffffffffffffffffff8b81166040958601528681165f90815261604c83528590208651815493880151968801519083167fffffffffffffffff00000000000000000000000000000000000000000000000090941693909317740100000000000000000000000000000000000000009690951695909502939093177fffffffffffff0000ffffffffffffffffffffffffffffffffffffffffffffffff1678010000000000000000000000000000000000000000000000009190921602178255606090920151600190910180547fffffffffffffffffffffffff000000000000000000000000000000000000000016919092161790555b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16887fd6ac66cf5ef5678b17b10f8b48c2765185f4f2b139842894bc5e7fce2aff9d2e848887604051612d9b93929190615b20565b60405180910390a49695505050505050565b5f8181526067602052604090205473ffffffffffffffffffffffffffffffffffffffff16611088576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610cbf565b73ffffffffffffffffffffffffffffffffffffffff8116612e84576040517f1d7b9e2200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f828152612f77602052604090205473ffffffffffffffffffffffffffffffffffffffff808316620100009092041603612eea576040517f2acbabd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f828152612f77602052604080822080547fffffffffffffffffffff0000000000000000000000000000000000000000ffff166201000073ffffffffffffffffffffffffffffffffffffffff8616908102919091179091559051909184917f815a7b07588e7ea8e1215949a7ff4e6b7ad525fd783567ad41ca1093dde1c1219190a35050565b5f81815260696020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091558190612fc982611484565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b61301a82825f61430c565b60405173ffffffffffffffffffffffffffffffffffffffff82169083907f1f0f31fb98449c6c6d9042af0dad644b67c406b4bc9996b2581c77c0108cba48905f90a35050565b5f83815261335f6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166130c9576040517f090daa9100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f838152612f77602052604090205461ffff1661ffff168261ffff161015610aad575f838152612f77602052604090205461ffff166040517f55320e0000000000000000000000000000000000000000000000000000000000815261ffff9091166004820152602401610cbf565b604051806040016040528061314b8761422f565b63ffffffff908116825261ffff80861660209384015273ffffffffffffffffffffffffffffffffffffffff8089165f818152615e5786526040808220938b1680835293875290819020875181549890970151909416640100000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000090971695909416949094179490941790555187907fea85788422f4b4e71907159b221a46645cb0e9c8ade05637904689e1c15e093190610f5b9087908790615b61565b6040517fd7e493c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b335f90815261604c60205260408120805463ffffffff7401000000000000000000000000000000000000000090910416919081906132a4845f908152612f77602052604090205473ffffffffffffffffffffffffffffffffffffffff620100009091041690565b925073ffffffffffffffffffffffffffffffffffffffff831661332c57835f036132fa576040517fef05ec8700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f895e1a5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8054612710907801000000000000000000000000000000000000000000000000900461ffff168602049150509193909250565b8273ffffffffffffffffffffffffffffffffffffffff1661337f82611484565b73ffffffffffffffffffffffffffffffffffffffff1614613422576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610cbf565b73ffffffffffffffffffffffffffffffffffffffff82166134c4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610cbf565b8273ffffffffffffffffffffffffffffffffffffffff166134e482611484565b73ffffffffffffffffffffffffffffffffffffffff1614613587576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610cbf565b5f81815260696020908152604080832080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811690915573ffffffffffffffffffffffffffffffffffffffff8781168086526068855283862080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01905590871680865283862080546001019055868652606790945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4610aad83838360016143c8565b5f5b81811015611f025761369b8484848481811061368157613681615aba565b905060200201602081019061369691906154ff565b613842565b600101613663565b73ffffffffffffffffffffffffffffffffffffffff8086165f90815261623f6020908152604080832093881683529281528282208683529052205463ffffffff168015613753578473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16827f0e2d557782991164095499aab37a3d8177adfb1f97fce0a12f8d7b49466336b38760405161374a91815260200190565b60405180910390a45b60405180604001604052806137678961422f565b63ffffffff908116825261ffff80871660209384015273ffffffffffffffffffffffffffffffffffffffff808b165f81815261623f86526040808220938d168083529387528082208c8352875290819020875181549890970151909416640100000000027fffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000090971695909416949094179490941790555189907fcc129567ae9a8e3c55e1ad3156090375e3c062bbbfdb78098a15bdf158a73b2b9061383190899089908990615b7d565b60405180910390a450505050505050565b73ffffffffffffffffffffffffffffffffffffffff811661388f576040517f1d7a89cf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f82815261335f6020908152604080832073ffffffffffffffffffffffffffffffffffffffff851684529091529020805460ff16156138fa576040517fdbd1a8d900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117815560405173ffffffffffffffffffffffffffffffffffffffff83169084907f1f2c9050d0cb7496cc1729c2ab051bafda1ebc461ce72e3505e2c3ffe18678bc905f90a3505050565b611088816143d4565b5f8061397e83611484565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614806139eb575073ffffffffffffffffffffffffffffffffffffffff8082165f908152606a602090815260408083209388168352929052205460ff165b8061224e57508373ffffffffffffffffffffffffffffffffffffffff16613a1184610b7d565b73ffffffffffffffffffffffffffffffffffffffff1614949350505050565b613a3c8282600161430c565b60405173ffffffffffffffffffffffffffffffffffffffff82169083907f7ff28266011814b6ef705d4afbdc5acdcfc98bc4121ff51fa9e8b38dfdc7c4b9905f90a35050565b60605f613a8e836143dd565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603613b54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610cbf565b73ffffffffffffffffffffffffffffffffffffffff8381165f818152606a602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b365f80375f80365f845af43d5f803e808015611b6c573d5ff35b6040515f903090613c40907f844b71a30000000000000000000000000000000000000000000000000000000090849036908790602001615b9f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052613c7891615c09565b5f60405180830381855afa9150503d805f8114613cb0576040519150601f19603f3d011682016040523d82523d5f602084013e613cb5565b606091505b505090503d5f803e808015611b6c573d5ff35b6060610a5a82611ec6565b61ffff821615613ce757613ce78383613d5c565b610aad8382612e37565b80515f03613d2b576040517f446150f300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f828152612b8f60205260409020610aad8282615c68565b611480828260405180602001604052805f81525061441d565b6113888161ffff161115613da0576040517f9027b87e0000000000000000000000000000000000000000000000000000000081526113886004820152602401610cbf565b5f828152612f77602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001661ffff8516908117909155915191825283917f7fe5681e1690fe17cf4e6eb3ab89d245aefd82ebcbdb10922d9a19c92a64df31910160405180910390a25050565b5f54610100900460ff16613ead576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610cbf565b6065613eb98382615c68565b506066610aad8282615c68565b7f00000000000000000000000000000000000000000000000000000000009896808110613f41576040517f0143c8d30000000000000000000000000000000000000000000000000000000081527f00000000000000000000000000000000000000000000000000000000009896806004820152602401610cbf565b6166275463ffffffff1615613f82576040517ff9df0dd900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613f8b8161422f565b61662780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff9290921691909117905550565b5f610a5a826144bf565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000cda72070e455bb31c7690a170224ce43623d0b6f1681148061405e57507f000000000000000000000000762340b8a40cdd5bfc3edd94265899fda345d0e373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b1561408e57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c90565b90565b60605f8080806140a386880188615d80565b9298509296509450909250905060018460018111156140c4576140c4615a8d565b146140fb576040517fa5d981a000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61410483421190565b1561413b576040517f58c8ca2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6141484262015180615dfc565b8311156141915761415c4262015180615dfc565b6040517f730a2276000000000000000000000000000000000000000000000000000000008152600401610cbf91815260200190565b5f7f71ad9c201ccd16fb90391f250c879758fe5ba86fc78ced782fdf1b540a1784418e8e8e8e8e8e8c805190602001208b6040516020016141da99989796959493929190615e34565b60405160208183030381529060405280519060200120905061421e7f00000000000000000000000037669abc021355f8b271fe60d67765e1fbe27ada828585614514565b505050505098975050505050505050565b5f63ffffffff821115614278576040517f6dfcc6500000000000000000000000000000000000000000000000000000000081526020600482015260248101839052604401610cbf565b5090565b5f763d602d80600a3d3981f3363d3d373d3d3d363d730000008260601b60e81c175f526e5af43d82803e903d91602b57fd5bf38260781b17602052603760095ff0905073ffffffffffffffffffffffffffffffffffffffff8116611ef1576040517fc2f868f400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f838152609760209081526040808320838052825280832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff82161c60011615614382576040517fbdf15e9000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f928352609760209081526040808520858052825280852073ffffffffffffffffffffffffffffffffffffffff90941685529290529120600160ff9092169190911b9055565b611f028484848461458f565b611088816145e5565b5f60ff8216601f811115610a5a576040517fb3512b0c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61442783836145ee565b6144335f848484614819565b610aad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610cbf565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f49064906000000000000000000000000000000000000000000000000000000001480610a5a5750610a5a826149f3565b5f61452861452185614ad5565b8484614b1c565b90508473ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610e76576040517f3d20eda800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8416156145e0575f828152616a0f6020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b611f02565b61108881614b46565b73ffffffffffffffffffffffffffffffffffffffff821661466b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610cbf565b5f8181526067602052604090205473ffffffffffffffffffffffffffffffffffffffff16156146f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610cbf565b5f8181526067602052604090205473ffffffffffffffffffffffffffffffffffffffff1615614781576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610cbf565b73ffffffffffffffffffffffffffffffffffffffff82165f81815260686020908152604080832080546001019055848352606790915280822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46114805f838360016143c8565b5f73ffffffffffffffffffffffffffffffffffffffff84163b156149eb578373ffffffffffffffffffffffffffffffffffffffff1663150b7a0261485b612712565b8786866040518563ffffffff1660e01b815260040161487d9493929190615ece565b6020604051808303815f875af19250505080156148d5575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526148d291810190615f0c565b60015b6149a0573d808015614902576040519150601f19603f3d011682016040523d82523d5f602084013e614907565b606091505b5080515f03614998576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610cbf565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a020000000000000000000000000000000000000000000000000000000014905061224e565b50600161224e565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd000000000000000000000000000000000000000000000000000000001480614a8557507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b80610a5a57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610a5a565b5f610a5a614ae1614b83565b836040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b5f805f80614b2b878787614cb6565b925092509250614b3b8282614d01565b509095945050505050565b5f818152612f776020526040902080547fffffffffffffffffffff0000000000000000000000000000000000000000000016905561108881614e04565b5f3073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000069525dac489e4718964b5615c3d794a25d62beb716148015614be857507f000000000000000000000000000000000000000000000000000000000000000146145b15614c1257507f65a32430f43688a48cf6678cba9deed6cc89cee7ff625d87df1ea1c1b773cbe890565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f62c3779c5abe1883445356f07c79aef0dd2efed8082847ba5f6041a0ef8877b6828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b5f80807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8416601b60ff86901c01614cf088828985614e24565b945094509450505093509350939050565b5f826003811115614d1457614d14615a8d565b03614d1d575050565b6001826003811115614d3157614d31615a8d565b03614d68576040517ff645eedf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002826003811115614d7c57614d7c615a8d565b03614db6576040517ffce698f700000000000000000000000000000000000000000000000000000000815260048101829052602401610cbf565b6003826003811115614dca57614dca615a8d565b03611480576040517fd78bce0c00000000000000000000000000000000000000000000000000000000815260048101829052602401610cbf565b5f818152612b8f60205260408120614e1b91614ff2565b61108881614f13565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0841115614e5d57505f91506003905082612134565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015614eae573d5f803e3d5ffd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116614f0457505f925060019150829050612134565b975f9750879650945050505050565b5f614f1d82611484565b9050614f2882611484565b5f83815260696020908152604080832080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811690915573ffffffffffffffffffffffffffffffffffffffff85168085526068845282852080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190558785526067909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4611480815f8460016143c8565b508054614ffe90615a3c565b5f825580601f1061500d575050565b601f0160209004905f5260205f209081019061108891905b80821115614278575f8155600101615025565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114611088575f80fd5b5f60208284031215615075575f80fd5b8135610edc81615038565b73ffffffffffffffffffffffffffffffffffffffff81168114611088575f80fd5b5f80604083850312156150b2575f80fd5b8235915060208301356150c481615080565b809150509250929050565b803561ffff81168114611ef1575f80fd5b5f8083601f8401126150f0575f80fd5b50813567ffffffffffffffff811115615107575f80fd5b602083019150836020828501011115612339575f80fd5b5f805f805f8060a08789031215615133575f80fd5b86359550602087013561514581615080565b9450615153604088016150cf565b9350606087013561516381615080565b9250608087013567ffffffffffffffff81111561517e575f80fd5b61518a89828a016150e0565b979a9699509497509295939492505050565b5f5b838110156151b657818101518382015260200161519e565b50505f910152565b5f81518084526151d581602086016020860161519c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081525f610edc60208301846151be565b5f60208284031215615229575f80fd5b5035919050565b5f8060408385031215615241575f80fd5b823561524c81615080565b946020939093013593505050565b5f805f6060848603121561526c575f80fd5b83359250602084013561527e81615080565b915061528c604085016150cf565b90509250925092565b5f805f606084860312156152a7575f80fd5b83356152b281615080565b925060208401356152c281615080565b929592945050506040919091013590565b5f805f805f608086880312156152e7575f80fd5b8535945060208601356152f981615080565b9350615307604087016150cf565b9250606086013567ffffffffffffffff811115615322575f80fd5b61532e888289016150e0565b969995985093965092949392505050565b5f805f805f60a08688031215615353575f80fd5b853561535e81615080565b9450602086013561536e81615080565b935060408601359250606086013561538581615080565b949793965091946080013592915050565b5f8083601f8401126153a6575f80fd5b50813567ffffffffffffffff8111156153bd575f80fd5b6020830191508360208260051b8501011115612339575f80fd5b5f805f805f80608087890312156153ec575f80fd5b6153f5876150cf565b9550602087013561540581615080565b9450604087013567ffffffffffffffff80821115615421575f80fd5b61542d8a838b016150e0565b90965094506060890135915080821115615445575f80fd5b5061518a89828a01615396565b5f805f805f8060a08789031215615467575f80fd5b86359550602087013561547981615080565b945060408701359350615163606088016150cf565b5f806040838503121561549f575f80fd5b82356154aa81615080565b915060208301356150c481615080565b5f805f80608085870312156154cd575f80fd5b8435935060208501356154df81615080565b9250604085013591506154f4606086016150cf565b905092959194509250565b5f6020828403121561550f575f80fd5b8135610edc81615080565b5f805f6040848603121561552c575f80fd5b83359250602084013567ffffffffffffffff8082111561554a575f80fd5b818601915086601f83011261555d575f80fd5b81358181111561556b575f80fd5b8760208260061b850101111561557f575f80fd5b6020830194508093505050509250925092565b7fff00000000000000000000000000000000000000000000000000000000000000881681525f602060e060208401526155ce60e084018a6151be565b83810360408501526155e0818a6151be565b6060850189905273ffffffffffffffffffffffffffffffffffffffff8816608086015260a0850187905284810360c0860152855180825260208088019350909101905f5b8181101561564057835183529284019291840191600101615624565b50909c9b505050505050505050505050565b5f805f60608486031215615664575f80fd5b833561566f81615080565b925060208401359150604084013561568681615080565b809150509250925092565b5f80604083850312156156a2575f80fd5b82356156ad81615080565b9150602083013580151581146150c4575f80fd5b5f805f604084860312156156d3575f80fd5b83359250602084013567ffffffffffffffff8111156156f0575f80fd5b6156fc868287016150e0565b9497909650939450505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f67ffffffffffffffff8084111561575057615750615709565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561579657615796615709565b816040528093508581528686860111156157ae575f80fd5b858560208301375f602087830101525050509392505050565b5f805f80608085870312156157da575f80fd5b84356157e581615080565b935060208501356157f581615080565b925060408501359150606085013567ffffffffffffffff811115615817575f80fd5b8501601f81018713615827575f80fd5b61583687823560208401615736565b91505092959194509250565b5f805f60408486031215615854575f80fd5b83359250602084013567ffffffffffffffff811115615871575f80fd5b6156fc86828701615396565b5f805f8060808587031215615890575f80fd5b8435935060208501356158a281615080565b92506158b0604086016150cf565b915060608501356158c081615080565b939692955090935050565b5f805f80608085870312156158de575f80fd5b84356158e981615080565b935060208501356158f981615080565b93969395505050506040820135916060013590565b5f805f8060608587031215615921575f80fd5b61592a856150cf565b9350602085013561593a81615080565b9250604085013567ffffffffffffffff811115615955575f80fd5b615961878288016150e0565b95989497509550505050565b5f806040838503121561597e575f80fd5b8235915061598e602084016150cf565b90509250929050565b5f805f805f805f6080888a0312156159ad575f80fd5b87356159b881615080565b9650602088013567ffffffffffffffff808211156159d4575f80fd5b6159e08b838c016150e0565b909850965060408a01359150808211156159f8575f80fd5b615a048b838c01615396565b909650945060608a0135915080821115615a1c575f80fd5b50615a298a828b01615396565b989b979a50959850939692959293505050565b600181811c90821680615a5057607f821691505b602082108103615a87577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215615af7575f80fd5b813560038110610edc575f80fd5b5f60208284031215615b15575f80fd5b8151610edc81615080565b73ffffffffffffffffffffffffffffffffffffffff8416815261ffff83166020820152606060408201525f615b5860608301846151be565b95945050505050565b61ffff83168152604060208201525f61224e60408301846151be565b83815261ffff83166020820152606060408201525f615b5860608301846151be565b7fffffffff00000000000000000000000000000000000000000000000000000000851681528284600483013760609190911b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166004919092019081019190915260180192915050565b5f8251615c1a81846020870161519c565b9190910192915050565b601f821115610aad57805f5260205f20601f840160051c81016020851015615c495750805b601f840160051c820191505b81811015610e76575f8155600101615c55565b815167ffffffffffffffff811115615c8257615c82615709565b615c9681615c908454615a3c565b84615c24565b602080601f831160018114615ce8575f8415615cb25750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b17855561158e565b5f858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b82811015615d3457888601518255948401946001909101908401615d15565b5085821015615d7057878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b01905550565b5f805f805f60a08688031215615d94575f80fd5b853560028110615da2575f80fd5b9450602086013567ffffffffffffffff811115615dbd575f80fd5b8601601f81018813615dcd575f80fd5b615ddc88823560208401615736565b959895975050505060408401359360608101359360809091013592509050565b80820180821115610a5a577f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b8981526020810189905273ffffffffffffffffffffffffffffffffffffffff8881166040830152871660608201526080810186905261ffff851660a0820152610120810160038510615ead577f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b8460c08301528360e0830152826101008301529a9950505050505050505050565b5f73ffffffffffffffffffffffffffffffffffffffff80871683528086166020840152508360408301526080606083015261123860808301846151be565b5f60208284031215615f1c575f80fd5b8151610edc8161503856fea26469706673582212201170f8e4cbe2595579ea1cbbebef2fcb8f636233dc52d624f84485c94eace32864736f6c63430008170033

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
Loading...
Loading
[ Download: CSV Export  ]

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.