ETH Price: $3,388.72 (+1.30%)

Contract

0xc3EC38233Af2eA665dec13174d6410A592EDa50c
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block
From
To
189450212024-01-06 1:49:35357 days ago1704505775  Contract Creation0 ETH
Loading...
Loading

Minimal Proxy Contract for 0x2c637fd2bddbd6c5a617c260068a04682e456779

Contract Name:
WorldSplit

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 1337000 runs

Other Settings:
shanghai EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 17 : WorldSplit.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

import { IERC1155 } from "@openzeppelin/contracts-v5/token/ERC1155/IERC1155.sol";
import { IERC1155Receiver } from "@openzeppelin/contracts-v5/token/ERC1155/IERC1155Receiver.sol";
import { IERC165 } from "@openzeppelin/contracts-v5/utils/introspection/IERC165.sol";
import { IERC20 } from "@openzeppelin/contracts-v5/token/ERC20/IERC20.sol";
import { IERC721 } from "@openzeppelin/contracts-v5/token/ERC721/IERC721.sol";
import { IERC721Receiver } from "@openzeppelin/contracts-v5/token/ERC721/IERC721Receiver.sol";
import { IWorldSplit } from "./interfaces/internal/IWorldSplit.sol";
import { IWorldsInventoryBySplit } from "./interfaces/internal/IWorldsInventoryBySplit.sol";

import { Address } from "@openzeppelin/contracts-v5/utils/Address.sol";
import { RouteCallLibrary } from "./libraries/RouteCallLibrary.sol";

import { ERC165 } from "@openzeppelin/contracts-v5/utils/introspection/ERC165.sol";
import { Ownable2Step } from "./mixins/worlds/split/Ownable2Step.sol";
import { WorldsNftNode } from "./mixins/shared/WorldsNftNode.sol";

import { SEND_VALUE_GAS_LIMIT_MULTIPLE_RECIPIENTS } from "./mixins/shared/Constants.sol";

/**
 * @title A contract to receive and forward funds, allowing sales to be associated with a World by payment address
 * alone.
 * @notice Intended to be used for ETH payments only, but recovery mechanisms are available for other asset types.
 * @author HardlyDifficult
 */
contract WorldSplit is IWorldSplit, IERC721Receiver, IERC1155Receiver, ERC165, WorldsNftNode, Ownable2Step {
  using Address for address payable;

  /**
   * @notice Emitted when an ETH payment is made while the split is not associated with a World.
   * All revenue is forwarded to the creator instead.
   * @param marketplace The address of the marketplace which forwarded payment.
   * @param valueInWei The amount of ETH received.
   */
  event NotInAWorld(address indexed marketplace, uint256 valueInWei);

  /**
   * @notice Emitted when the owner of this contract is non-receivable and the ETH transfer fails.
   * Revenue is stored in this address for future withdraw.
   * @param escrowedValueInWei The total amount of ETH currently in escrow.
   */
  event PaymentEscrowed(uint256 escrowedValueInWei);

  /**
   * @notice Emitted when the owner of the contract makes an arbitrary call.
   * @param operator The current owner and account which initiated the function call.
   * @param target The address of the contract which received the call.
   */
  event ProxyCall(address indexed operator, address indexed target);

  /**
   * @notice Emitted when the owner of the contract withdraws ETH.
   * @param owner The owner which received the ETH.
   * @param amount How much ETH was transferred.
   */
  event WithdrawETH(address indexed owner, uint256 amount);

  error WorldSplit_No_ETH_Balance_To_Withdraw();
  error WorldSplit_No_ERC1155_Balance_To_Withdraw();
  error WorldSplit_No_ERC20_Balance_To_Withdraw();
  error WorldSplit_Owner_Cannot_Be_Zero_Address();

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

  /**
   * @notice Set immutable variables for the implementation contract.
   * @param _worlds The address of the Worlds NFT contract.
   */
  constructor(address _worlds) WorldsNftNode(_worlds) {
    // Initialize the template to a non-zero & unusable address so it cannot be initialized.
    _transferOwnership(0x000000000000000000000000000000000000dEaD);
  }

  /**
   * @notice Initialize this instance of the split for a particular listing.
   * @param ownerAndAssetRecipient The owner of this contract which will receive assets sent to this contract.
   */
  function initialize(address payable ownerAndAssetRecipient) external onlyUnassignedOwner {
    if (ownerAndAssetRecipient == address(0)) {
      revert WorldSplit_Owner_Cannot_Be_Zero_Address();
    }
    _transferOwnership(ownerAndAssetRecipient);
  }

  ////////////////////////////////////////////////////////////////
  // Receivers / Auto-Forwarders
  ////////////////////////////////////////////////////////////////

  /**
   * @notice When ETH is sent to this contract, check for an association via the Worlds contract before forwarding the
   * ETH to the curator (if applicable) and the creator.
   * @dev If the split is no longer associated with a World, fallback to sending the ETH to the owner of this contract.
   */
  receive() external payable {
    bool success;

    // Forwards the ETH received to the Worlds contract for attribution and distribution.
    // A gas limit is applied to ensure Worlds doesn't get stuck in a loop or otherwise exhaust a reasonable limit.
    try
      IWorldsInventoryBySplit(worlds).soldInWorldBySplit{ gas: SEND_VALUE_GAS_LIMIT_MULTIPLE_RECIPIENTS }(
        msg.sender,
        msg.value
      )
    returns (address payable worldPaymentAddress, uint256 curatorTakeInWei) {
      // Assume that the Worlds contract emitted the appropriate event.

      if (curatorTakeInWei != 0) {
        (success, ) = worldPaymentAddress.call{
          value: curatorTakeInWei,
          gas: SEND_VALUE_GAS_LIMIT_MULTIPLE_RECIPIENTS
        }("");

        if (!success) {
          // If the curator payment reverts, the full amount will be sent to the creator.
          // Emit the failure from the Worlds contract to simplify reporting.
          IWorldsInventoryBySplit(worlds).soldInWorldBySplitWorldPaymentFailed{
            gas: SEND_VALUE_GAS_LIMIT_MULTIPLE_RECIPIENTS
          }(msg.sender, msg.value);
        }
      }
    } catch {
      emit NotInAWorld(msg.sender, msg.value);
    }

    if (address(this).balance != 0) {
      // Send the remainder to the owner without any gas restriction.
      (success, ) = owner().call{ value: address(this).balance }("");
      // If the owner consumes all gas on payment, the original ETH transfer may revert.

      if (!success) {
        emit PaymentEscrowed(address(this).balance);
      }
    }
  }

  /**
   * @notice If an ERC721 is send to this contract, immediately transfer it to the owner of this contract instead.
   * @dev This is not a supported use case, but included to make a best effort at forwarding assets to the owner.
   */
  function onERC721Received(
    address /* operator */,
    address /* from */,
    uint256 tokenId,
    bytes calldata data
  ) external returns (bytes4) {
    IERC721(msg.sender).safeTransferFrom(address(this), owner(), tokenId, data);
    // Assume the ERC721 contract emitted the appropriate event.
    return IERC721Receiver.onERC721Received.selector;
  }

  /**
   * @notice If an ERC1155 is send to this contract, immediately transfer it to the owner of this contract instead.
   * @dev This is not a supported use case, but included to make a best effort at forwarding assets to the owner.
   */
  function onERC1155Received(
    address /* operator */,
    address /* from */,
    uint256 id,
    uint256 value,
    bytes calldata data
  ) external override returns (bytes4) {
    IERC1155(msg.sender).safeTransferFrom(address(this), owner(), id, value, data);
    // Assume the ERC1155 contract emitted the appropriate event.
    return IERC1155Receiver.onERC1155Received.selector;
  }

  /**
   * @notice If multiple ERC1155s are send to this contract, immediately transfer them to the owner of this contract
   * instead.
   * @dev This is not a supported use case, but included to make a best effort at forwarding assets to the owner.
   */
  function onERC1155BatchReceived(
    address /* operator */,
    address /* from */,
    uint256[] calldata ids,
    uint256[] calldata values,
    bytes calldata data
  ) external override returns (bytes4) {
    IERC1155(msg.sender).safeBatchTransferFrom(address(this), owner(), ids, values, data);
    // Assume the ERC1155 contract emitted the appropriate event.
    return IERC1155Receiver.onERC1155BatchReceived.selector;
  }

  ////////////////////////////////////////////////////////////////
  // Recovery Functions
  ////////////////////////////////////////////////////////////////

  /**
   * @notice Allow the owner of this contract to make any arbitrary call.
   * @param target The contract address to call.
   * @param valueInWei How much ETH to send with the call.
   * @param callData The function on the `target` to call.
   * @dev This function is not normally required, but included to allow the recovery of any unaccounted for assets or
   * permissions.
   */
  function proxyCall(
    address target,
    uint256 valueInWei,
    bytes calldata callData
  ) external payable onlyOwner returns (bytes memory returnData) {
    bool success;
    (success, returnData) = target.call{ value: valueInWei }(callData);
    if (!success) {
      RouteCallLibrary.revertWithError(returnData);
    }

    emit ProxyCall(msg.sender, target);

    // After the call, refund any ETH remaining in the contract.
    if (address(this).balance > 0) {
      _withdrawETH();
    }
  }

  /**
   * @notice Allow anyone to send any ETH held by this contract to the owner.
   */
  function withdrawETH() external {
    if (address(this).balance == 0) {
      revert WorldSplit_No_ETH_Balance_To_Withdraw();
    }
    _withdrawETH();
  }

  function _withdrawETH() private {
    uint256 balance = address(this).balance;
    payable(owner()).sendValue(balance);

    emit WithdrawETH(owner(), balance);
  }

  /**
   * @notice Allow anyone to transfer an ERC-1155 token to the owner.
   * @param nftContract The address of the ERC-1155 contract.
   * @param tokenId The ID of the token to transfer.
   */
  function withdrawERC1155(IERC1155 nftContract, uint256 tokenId) external {
    uint256 balance = nftContract.balanceOf(address(this), tokenId);
    if (balance == 0) {
      revert WorldSplit_No_ERC1155_Balance_To_Withdraw();
    }
    nftContract.safeTransferFrom(address(this), owner(), tokenId, balance, "");
    // Assume the ERC1155 contract emitted the appropriate event.
  }

  /**
   * @notice Allow anyone to transfer the balance of an ERC-20 token to the owner.
   * @param token The address of the ERC-20 contract.
   */
  function withdrawERC20(IERC20 token) external {
    uint256 balance = token.balanceOf(address(this));
    if (balance == 0) {
      revert WorldSplit_No_ERC20_Balance_To_Withdraw();
    }
    token.transfer(owner(), balance);
    // Assume the ERC20 contract emitted the appropriate event.
  }

  /**
   * @notice Allow anyone to transfer an ERC-721 token to the owner.
   * @param nftContract The address of the ERC-721 contract.
   * @param tokenId The ID of the token to transfer.
   */
  function withdrawERC721(IERC721 nftContract, uint256 tokenId) external {
    nftContract.transferFrom(address(this), owner(), tokenId);
    // Assume the ERC721 contract emitted the appropriate event.
  }

  ////////////////////////////////////////////////////////////////
  // ERC165
  ////////////////////////////////////////////////////////////////

  /// @inheritdoc IERC165
  function supportsInterface(
    bytes4 interfaceId
  ) public view override(IERC165, ERC165, Ownable2Step) returns (bool isSupported) {
    isSupported =
      interfaceId == type(IERC721Receiver).interfaceId ||
      interfaceId == type(IERC1155Receiver).interfaceId ||
      super.supportsInterface(interfaceId);
  }
}

File 2 of 17 : 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 3 of 17 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the value of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(
        address[] calldata accounts,
        uint256[] calldata ids
    ) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`.
     *
     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens
     * to an untrusted contract, when invoking {onERC1155Received} on the receiver.
     * Ensure to follow the checks-effects-interactions pattern and consider employing
     * reentrancy guards when interacting with untrusted contracts.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `value` amount.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * WARNING: This function can potentially allow a reentrancy attack when transferring tokens
     * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver.
     * Ensure to follow the checks-effects-interactions pattern and consider employing
     * reentrancy guards when interacting with untrusted contracts.
     *
     * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments.
     *
     * Requirements:
     *
     * - `ids` and `values` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external;
}

File 4 of 17 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

/**
 * @dev Interface that must be implemented by smart contracts in order to receive
 * ERC-1155 token transfers.
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 5 of 17 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

File 6 of 17 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @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 address zero.
     *
     * 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 17 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.20;

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

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

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) 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 FailedInnerCall();
        }
    }
}

File 9 of 17 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

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

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

File 10 of 17 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

File 11 of 17 : 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 12 of 17 : IWorldSplit.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

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

File 13 of 17 : 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 14 of 17 : 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 15 of 17 : 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 an exhibition 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 16 of 17 : WorldsNftNode.sol
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity ^0.8.18;

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

error WorldsNftNode_Worlds_NFT_Is_Not_A_Contract();

/**
 * @title Stores a reference to the Worlds NFT contract for contracts to leverage.
 * @author HardlyDifficult
 */
abstract contract WorldsNftNode {
  using AddressUpgradeable for address;

  address internal immutable worlds;

  constructor(address worldsNft) {
    if (!worldsNft.isContract()) {
      revert WorldsNftNode_Worlds_NFT_Is_Not_A_Contract();
    }

    worlds = worldsNft;
  }

  /**
   * @notice Returns the address of the Worlds NFT contract.
   */
  function getWorldsNftAddress() external view returns (address worldsNft) {
    worldsNft = worlds;
  }

  // This mixin uses 0 slots.
}

File 17 of 17 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

// Slightly modified from:
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
// in order to simplify & optimize for our use case.
// Removes renounceOwnership, comments for our use case, updates errors, adds supportsInterface to be EIP-173 compliant.

import { ERC165 } from "@openzeppelin/contracts-v5/utils/introspection/ERC165.sol";
import { IOwnable } from "../../../interfaces/standards/IOwnable.sol";

/**
 * @title Defines an owner for the contract which receives assets sent to this address.
 * @author OpenZeppelin & HardlyDifficult
 */
abstract contract Ownable2Step is IOwnable, ERC165 {
  /// @notice The current owner of the contract.
  address private _owner;

  /// @notice The account which may accept an ownership transfer, or address(0) if there is no pending transfer.
  address private _pendingOwner;

  /// @notice Emitted when ownership of a contract changes, including when the contract is initially deployed.
  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

  /// @notice Emitted when an ownership transfer is initiated. `newOwner` is set to 0 if a pending transfer is canceled.
  event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);

  error Ownable_Already_Initialized(address currentOwner);
  error Ownable_Not_Pending_Owner(address currentPendingOwner);
  error Ownable_Sender_Is_Not_Owner(address currentOwner);
  error Ownable_Transfer_To_Already_Initiated(address currentPendingOwner);

  ////////////////////////////////////////////////////////////////
  // Ownership
  ////////////////////////////////////////////////////////////////

  /// @notice Reverts if called by any account other than the owner.
  modifier onlyOwner() {
    if (_owner != msg.sender) {
      revert Ownable_Sender_Is_Not_Owner(_owner);
    }
    _;
  }

  /// @notice Reverts if called after an owner has already been assigned.
  /// @dev Used to determine if the contract has already been initialized.
  modifier onlyUnassignedOwner() {
    if (_owner != address(0)) {
      revert Ownable_Already_Initialized(_owner);
    }
    _;
  }

  /**
   * @notice Returns the address of the current owner which receives assets sent to this address.
   */
  function owner() public view returns (address ownerAndAssetRecipient) {
    ownerAndAssetRecipient = _owner;
  }

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

  /**
   * @notice Transfers ownership of the contract to a new account (`newOwner`).
   * @dev Can only be called by the current owner.
   */
  function transferOwnership(address newOwner) external onlyOwner {
    if (newOwner == _pendingOwner) {
      revert Ownable_Transfer_To_Already_Initiated(_pendingOwner);
    }

    _pendingOwner = newOwner;
    emit OwnershipTransferStarted(_owner, newOwner);
  }

  /**
   * @notice Accept a pending transfer, making the caller the new owner which receives assets sent to this address.
   */
  function acceptOwnership() external {
    if (_pendingOwner != msg.sender) {
      revert Ownable_Not_Pending_Owner(_pendingOwner);
    }
    _transferOwnership(msg.sender);
  }

  /**
   * @notice Transfers ownership of the contract to a new account (`newOwner`).
   * @dev Internal function without access restriction.
   * Used on initialize to set the original owner.
   */
  function _transferOwnership(address newOwner) internal {
    address oldOwner = _owner;
    _owner = newOwner;
    emit OwnershipTransferred(oldOwner, newOwner);
    delete _pendingOwner;
  }

  /**
   * @notice Returns the address of the pending owner.
   * @dev Returns address(0) if there is no pending owner.
   */
  function pendingOwner() external view returns (address currentPendingOwner) {
    currentPendingOwner = _pendingOwner;
  }

  ////////////////////////////////////////////////////////////////
  // ERC165
  ////////////////////////////////////////////////////////////////

  function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool isSupported) {
    isSupported = interfaceId == type(IOwnable).interfaceId || super.supportsInterface(interfaceId);
  }
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_worlds","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"address","name":"currentOwner","type":"address"}],"name":"Ownable_Already_Initialized","type":"error"},{"inputs":[{"internalType":"address","name":"currentPendingOwner","type":"address"}],"name":"Ownable_Not_Pending_Owner","type":"error"},{"inputs":[{"internalType":"address","name":"currentOwner","type":"address"}],"name":"Ownable_Sender_Is_Not_Owner","type":"error"},{"inputs":[{"internalType":"address","name":"currentPendingOwner","type":"address"}],"name":"Ownable_Transfer_To_Already_Initiated","type":"error"},{"inputs":[],"name":"RouteCallLibrary_Call_Failed_Without_Revert_Reason","type":"error"},{"inputs":[],"name":"WorldSplit_No_ERC1155_Balance_To_Withdraw","type":"error"},{"inputs":[],"name":"WorldSplit_No_ERC20_Balance_To_Withdraw","type":"error"},{"inputs":[],"name":"WorldSplit_No_ETH_Balance_To_Withdraw","type":"error"},{"inputs":[],"name":"WorldSplit_Owner_Cannot_Be_Zero_Address","type":"error"},{"inputs":[],"name":"WorldsNftNode_Worlds_NFT_Is_Not_A_Contract","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"marketplace","type":"address"},{"indexed":false,"internalType":"uint256","name":"valueInWei","type":"uint256"}],"name":"NotInAWorld","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"escrowedValueInWei","type":"uint256"}],"name":"PaymentEscrowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"target","type":"address"}],"name":"ProxyCall","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawETH","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getWorldsNftAddress","outputs":[{"internalType":"address","name":"worldsNft","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"ownerAndAssetRecipient","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"ownerAndAssetRecipient","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"currentPendingOwner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"valueInWei","type":"uint256"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"proxyCall","outputs":[{"internalType":"bytes","name":"returnData","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"isSupported","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC1155","name":"nftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdrawERC1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"nftContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdrawERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

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.