S Price: $0.540558 (-2.84%)

Contract

0xc5CDdAc466FD39248F0eB060d042b22668317e47

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC404SinglePerToken

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 9999999 runs

Other Settings:
cancun EvmVersion
File 1 of 30 : ERC404SinglePerToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {IERC2981, ERC2981} from "@openzeppelin/contracts/token/common/ERC2981.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC721Metadata} from "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {Registry} from "../Registry.sol";
import {IFactoryNFT} from "../IFactoryNFT.sol";
import {ILaunchpadNFT} from "../../interfaces/ILaunchpadNFT.sol";

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

contract ERC404SinglePerToken is OwnableUpgradeable, ILaunchpadNFT, IFactoryNFT, ERC2981, ERC404Upgradeable {
  using Strings for uint256;

  error NotLaunchpad();
  error ERC404NonexistentToken(uint256 tokenId);
  error ERC20TransfersNotAllowedYet();

  uint16 private _royaltyBps;
  address private _royaltyRecipient;
  bool internal _canTransferERC20;

  address internal _launchpad;
  Registry internal _registry;
  string private _baseTokenURI;

  modifier onlyLaunchpad() {
    require(address(_launchpad) == _msgSender(), NotLaunchpad());
    _;
  }

  /// @custom:oz-upgrades-unsafe-allow constructor
  constructor() {
    _disableInitializers();
    _initialChainId = block.chainid;
    _initialDomainSeparator = _computeDomainSeparator();
  }

  function initialize(
    address registry,
    address launchpad,
    string calldata baseTokenURI,
    string calldata nftName,
    string calldata nftSymbol,
    uint16 royaltyBps,
    address royaltyRecipient,
    address contractOwner
  ) external virtual initializer {
    __ERC404SinglePerToken_init(
      registry,
      launchpad,
      baseTokenURI,
      nftName,
      nftSymbol,
      royaltyBps,
      royaltyRecipient,
      contractOwner
    );
  }

  function __ERC404SinglePerToken_init(
    address registry,
    address launchpad,
    string calldata baseTokenURI,
    string calldata nftName,
    string calldata nftSymbol,
    uint16 royaltyBps,
    address royaltyRecipient,
    address contractOwner
  ) internal onlyInitializing {
    __Ownable_init(contractOwner);
    __ER404_init(nftName, nftSymbol);
    __ERC404SinglePerToken_init_unchained(registry, launchpad, baseTokenURI, royaltyBps, royaltyRecipient);
  }

  function __ERC404SinglePerToken_init_unchained(
    address registry,
    address launchpad,
    string calldata baseTokenURI,
    uint16 royaltyBps,
    address royaltyRecipient
  ) internal onlyInitializing {
    _launchpad = launchpad;
    _registry = Registry(registry);
    _baseTokenURI = baseTokenURI;
    _royaltyBps = royaltyBps;
    _royaltyRecipient = royaltyRecipient;
  }

  function setDetails(string calldata baseTokenURI) external override onlyLaunchpad {
    _baseTokenURI = baseTokenURI;
  }

  // Never use the actual ids because minting is sequential
  function mint(
    address to,
    uint256[] memory ids,
    uint256[] memory /*values */
  ) external onlyLaunchpad returns (uint256[] memory mintedTokenIds, uint256[] memory mintedAmounts) {
    uint256 erc20Amount = ids.length * UNITS;

    mintedTokenIds = new uint256[](ids.length);
    mintedAmounts = new uint256[](ids.length);
    uint256 mintedNum = minted;
    for (uint256 i = 0; i < ids.length; ++i) {
      mintedTokenIds[i] = ID_ENCODING_PREFIX + ++mintedNum;
      mintedAmounts[i] = 1; // Always assuming 1 NFT for now
    }

    _mintERC20(to, erc20Amount);
  }

  // Hook for when the launchpad claim has been made
  // Allow ERC20s to be transferred
  function claimedHook() external override onlyLaunchpad {
    _canTransferERC20 = true;
  }

  function transfer(address to, uint256 value) public override returns (bool) {
    require(_canTransferERC20, ERC20TransfersNotAllowedYet());
    return super.transfer(to, value);
  }

  function _baseURI() internal view returns (string memory) {
    return _baseTokenURI;
  }

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

    string memory baseURI = _baseURI();

    // Invert the ID encoding
    uint256 invertedTokenId = tokenId - ID_ENCODING_PREFIX;
    return string.concat(baseURI, invertedTokenId.toString(), ".json");
  }

  /**
   * @dev See {ERC2981-royaltyInfo}.
   */
  function royaltyInfo(
    uint256 /*tokenId*/,
    uint256 salePrice
  ) public view override returns (address recipient, uint256 royaltyAmount) {
    recipient = _royaltyRecipient;
    royaltyAmount = (salePrice * _royaltyBps) / 10000;
  }

  /**
   * @dev See {IERC165-supportsInterface}.
   */
  function supportsInterface(bytes4 interfaceId) public view override(ERC2981, ERC404Upgradeable) returns (bool) {
    return
      interfaceId == type(ILaunchpadNFT).interfaceId ||
      interfaceId == type(IERC721).interfaceId ||
      interfaceId == type(IERC721Metadata).interfaceId ||
      interfaceId == type(IERC2981).interfaceId ||
      super.supportsInterface(interfaceId);
  }

  /**
   * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
   * Returns the owner.
   *
   * Overrides to ownership logic should be done to {ownerOf}.
   */
  function _requireOwned(uint256 tokenId) internal view returns (address) {
    address owner = ownerOf(tokenId);
    if (owner == address(0)) {
      revert ERC404NonexistentToken(tokenId);
    }
    return owner;
  }

  function setBaseURI(string calldata baseTokenURI) external onlyOwner {
    _baseTokenURI = baseTokenURI;
  }

  function setRoyalty(uint16 royaltyBps, address royaltyRecipient) external onlyOwner {
    _royaltyBps = royaltyBps;
    _royaltyRecipient = royaltyRecipient;
  }
}

File 2 of 30 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Ownable
    struct OwnableStorage {
        address _owner;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300;

    function _getOwnableStorage() private pure returns (OwnableStorage storage $) {
        assembly {
            $.slot := OwnableStorageLocation
        }
    }

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    function __Ownable_init(address initialOwner) internal onlyInitializing {
        __Ownable_init_unchained(initialOwner);
    }

    function __Ownable_init_unchained(address initialOwner) internal onlyInitializing {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        OwnableStorage storage $ = _getOwnableStorage();
        return $._owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        OwnableStorage storage $ = _getOwnableStorage();
        address oldOwner = $._owner;
        $._owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 30 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @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 Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._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 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._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() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @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 {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

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

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

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

File 4 of 30 : UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/UUPSUpgradeable.sol)

pragma solidity ^0.8.20;

import {IERC1822Proxiable} from "@openzeppelin/contracts/interfaces/draft-IERC1822.sol";
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
import {Initializable} from "./Initializable.sol";

/**
 * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
 * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
 *
 * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
 * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
 * `UUPSUpgradeable` with a custom implementation of upgrades.
 *
 * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
 */
abstract contract UUPSUpgradeable is Initializable, IERC1822Proxiable {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable __self = address(this);

    /**
     * @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
     * and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
     * while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
     * If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
     * be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
     * during an upgrade.
     */
    string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";

    /**
     * @dev The call is from an unauthorized context.
     */
    error UUPSUnauthorizedCallContext();

    /**
     * @dev The storage `slot` is unsupported as a UUID.
     */
    error UUPSUnsupportedProxiableUUID(bytes32 slot);

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

    /**
     * @dev Check that the execution is not being performed through a delegate call. This allows a function to be
     * callable on the implementing contract but not through proxies.
     */
    modifier notDelegated() {
        _checkNotDelegated();
        _;
    }

    function __UUPSUpgradeable_init() internal onlyInitializing {
    }

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

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

    /**
     * @dev Reverts if the execution is not performed via delegatecall or the execution
     * context is not of a proxy with an ERC1967-compliant implementation pointing to self.
     * See {_onlyProxy}.
     */
    function _checkProxy() internal view virtual {
        if (
            address(this) == __self || // Must be called through delegatecall
            ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
        ) {
            revert UUPSUnauthorizedCallContext();
        }
    }

    /**
     * @dev Reverts if the execution is performed via delegatecall.
     * See {notDelegated}.
     */
    function _checkNotDelegated() internal view virtual {
        if (address(this) != __self) {
            // Must not be called through delegatecall
            revert UUPSUnauthorizedCallContext();
        }
    }

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

    /**
     * @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
     *
     * As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
     * is expected to be the implementation slot in ERC1967.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
        try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
            if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
                revert UUPSUnsupportedProxiableUUID(slot);
            }
            ERC1967Utils.upgradeToAndCall(newImplementation, data);
        } catch {
            // The implementation is not UUPS
            revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
        }
    }
}

File 5 of 30 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;
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;
    }
}

File 6 of 30 : draft-IERC1822.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC1822.sol)

pragma solidity ^0.8.20;

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

File 7 of 30 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

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

File 8 of 30 : IERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 */
interface IERC2981 is IERC165 {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(
        uint256 tokenId,
        uint256 salePrice
    ) external view returns (address receiver, uint256 royaltyAmount);
}

File 9 of 30 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC721Receiver.sol)

pragma solidity ^0.8.20;

import {IERC721Receiver} from "../token/ERC721/IERC721Receiver.sol";

File 10 of 30 : IBeacon.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol)

pragma solidity ^0.8.20;

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

File 11 of 30 : ERC1967Utils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/ERC1967/ERC1967Utils.sol)

pragma solidity ^0.8.20;

import {IBeacon} from "../beacon/IBeacon.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";

/**
 * @dev This abstract contract provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
 */
library ERC1967Utils {
    // We re-declare ERC-1967 events here because they can't be used directly from IERC1967.
    // This will be fixed in Solidity 0.8.21. At that point we should remove these events.
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

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

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

    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev The `implementation` of the proxy is invalid.
     */
    error ERC1967InvalidImplementation(address implementation);

    /**
     * @dev The `admin` of the proxy is invalid.
     */
    error ERC1967InvalidAdmin(address admin);

    /**
     * @dev The `beacon` of the proxy is invalid.
     */
    error ERC1967InvalidBeacon(address beacon);

    /**
     * @dev An upgrade function sees `msg.value > 0` that may be lost.
     */
    error ERC1967NonPayable();

    /**
     * @dev Returns the current implementation address.
     */
    function getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
        _setImplementation(newImplementation);
        emit Upgraded(newImplementation);

        if (data.length > 0) {
            Address.functionDelegateCall(newImplementation, data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the EIP1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        if (newAdmin == address(0)) {
            revert ERC1967InvalidAdmin(address(0));
        }
        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
    }

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

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the EIP1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

        address beaconImplementation = IBeacon(newBeacon).implementation();
        if (beaconImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(beaconImplementation);
        }
    }

    /**
     * @dev Change the beacon and trigger a setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-BeaconUpgraded} event.
     *
     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
     * efficiency.
     */
    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
        _setBeacon(newBeacon);
        emit BeaconUpgraded(newBeacon);

        if (data.length > 0) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
     * if an upgrade doesn't perform an initialization call.
     */
    function _checkNonPayable() private {
        if (msg.value > 0) {
            revert ERC1967NonPayable();
        }
    }
}

File 12 of 30 : ERC2981.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.20;

import {IERC2981} from "../../interfaces/IERC2981.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information.
 *
 * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for
 * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first.
 *
 * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the
 * fee is specified in basis points by default.
 *
 * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
 * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to
 * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

    RoyaltyInfo private _defaultRoyaltyInfo;
    mapping(uint256 tokenId => RoyaltyInfo) private _tokenRoyaltyInfo;

    /**
     * @dev The default royalty set is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidDefaultRoyalty(uint256 numerator, uint256 denominator);

    /**
     * @dev The default royalty receiver is invalid.
     */
    error ERC2981InvalidDefaultRoyaltyReceiver(address receiver);

    /**
     * @dev The royalty set for an specific `tokenId` is invalid (eg. (numerator / denominator) >= 1).
     */
    error ERC2981InvalidTokenRoyalty(uint256 tokenId, uint256 numerator, uint256 denominator);

    /**
     * @dev The royalty receiver for `tokenId` is invalid.
     */
    error ERC2981InvalidTokenRoyaltyReceiver(uint256 tokenId, address receiver);

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

    /**
     * @inheritdoc IERC2981
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address, uint256) {
        RoyaltyInfo memory royalty = _tokenRoyaltyInfo[tokenId];

        if (royalty.receiver == address(0)) {
            royalty = _defaultRoyaltyInfo;
        }

        uint256 royaltyAmount = (salePrice * royalty.royaltyFraction) / _feeDenominator();

        return (royalty.receiver, royaltyAmount);
    }

    /**
     * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a
     * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an
     * override.
     */
    function _feeDenominator() internal pure virtual returns (uint96) {
        return 10000;
    }

    /**
     * @dev Sets the royalty information that all ids in this contract will default to.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidDefaultRoyalty(feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidDefaultRoyaltyReceiver(address(0));
        }

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Removes default royalty information.
     */
    function _deleteDefaultRoyalty() internal virtual {
        delete _defaultRoyaltyInfo;
    }

    /**
     * @dev Sets the royalty information for a specific token id, overriding the global default.
     *
     * Requirements:
     *
     * - `receiver` cannot be the zero address.
     * - `feeNumerator` cannot be greater than the fee denominator.
     */
    function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual {
        uint256 denominator = _feeDenominator();
        if (feeNumerator > denominator) {
            // Royalty fee will exceed the sale price
            revert ERC2981InvalidTokenRoyalty(tokenId, feeNumerator, denominator);
        }
        if (receiver == address(0)) {
            revert ERC2981InvalidTokenRoyaltyReceiver(tokenId, address(0));
        }

        _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator);
    }

    /**
     * @dev Resets royalty information for the token id back to the global default.
     */
    function _resetTokenRoyalty(uint256 tokenId) internal virtual {
        delete _tokenRoyaltyInfo[tokenId];
    }
}

File 13 of 30 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.20;

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

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @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 14 of 30 : 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 15 of 30 : 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 16 of 30 : 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 17 of 30 : 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 18 of 30 : 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 19 of 30 : 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 20 of 30 : 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 30 : 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 22 of 30 : 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 23 of 30 : ERC404Upgradeable.sol
// SPDX-License-Identifier: MIT
// Modified from Pandora ERC404 implementation
pragma solidity ^0.8.28;

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/interfaces/IERC721Receiver.sol";
import {IERC165} from "@openzeppelin/contracts/interfaces/IERC165.sol";

import {IERC404} from "./interfaces/IERC404.sol";
import {DoubleEndedQueue} from "./lib/DoubleEndedQueue.sol";
import {ERC721Events} from "./lib/ERC721Events.sol";
import {ERC20Events} from "./lib/ERC20Events.sol";

abstract contract ERC404Upgradeable is Initializable, IERC404 {
  using DoubleEndedQueue for DoubleEndedQueue.Uint256Deque;

  /// @dev The queue of ERC-721 tokens stored in the contract.
  DoubleEndedQueue.Uint256Deque private _storedERC721Ids;

  /// @dev Token name
  string public name;

  /// @dev Token symbol
  string public symbol;

  /// @dev Decimals for ERC-20 representation
  uint8 public constant decimals = 18;

  /// @dev Units for ERC-20 representation
  uint256 public constant UNITS = 10 ** decimals;

  /// @dev Total supply in ERC-20 representation
  uint256 public totalSupply;

  /// @dev Current mint counter which also represents the highest
  ///      minted id, monotonically increasing to ensure accurate ownership
  uint256 public minted;

  /// @dev Initial chain id for EIP-2612 support
  uint256 internal _initialChainId;

  /// @dev Initial domain separator for EIP-2612 support
  bytes32 internal _initialDomainSeparator;

  /// @dev Balance of user in ERC-20 representation
  mapping(address => uint256) public balanceOf;

  /// @dev Allowance of user in ERC-20 representation
  mapping(address => mapping(address => uint256)) public allowance;

  /// @dev Approval in ERC-721 representaion
  mapping(uint256 => address) public getApproved;

  /// @dev Approval for all in ERC-721 representation
  mapping(address => mapping(address => bool)) public isApprovedForAll;

  /// @dev Packed representation of ownerOf and owned indices
  mapping(uint256 => uint256) internal _ownedData;

  /// @dev Array of owned ids in ERC-721 representation
  mapping(address => uint256[]) internal _owned;

  /// @dev Addresses that are exempt from ERC-721 transfer, typically for gas savings (pairs, routers, etc)
  mapping(address => bool) internal _erc721TransferExempt;

  /// @dev EIP-2612 nonces
  mapping(address => uint256) public nonces;

  /// @dev Address bitmask for packed ownership data
  uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;

  /// @dev Owned index bitmask for packed ownership data
  uint256 private constant _BITMASK_OWNED_INDEX = ((1 << 96) - 1) << 160;

  /// @dev Constant for token id encoding
  uint256 public constant ID_ENCODING_PREFIX = 1 << 255;

  /// @custom:oz-upgrades-unsafe-allow constructor
  constructor() {
    _disableInitializers();
  }

  function __ER404_init(string memory name_, string memory symbol_) internal onlyInitializing {
    __ER404_init_unchained(name_, symbol_);
  }

  function __ER404_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
    name = name_;
    symbol = symbol_;

    // Must set name before calling _computeDomainSeparator!
    _initialChainId = block.chainid;
    _initialDomainSeparator = _computeDomainSeparator();
  }

  /// @notice Function to find owner of a given ERC-721 token
  function ownerOf(uint256 id_) public view virtual returns (address erc721Owner) {
    erc721Owner = _getOwnerOf(id_);

    if (!_isValidTokenId(id_)) {
      revert InvalidTokenId();
    }

    if (erc721Owner == address(0)) {
      revert NotFound();
    }
  }

  function owned(address owner_) public view virtual returns (uint256[] memory) {
    return _owned[owner_];
  }

  function erc721BalanceOf(address owner_) public view virtual returns (uint256) {
    return _owned[owner_].length;
  }

  function erc20BalanceOf(address owner_) public view virtual returns (uint256) {
    return balanceOf[owner_];
  }

  function erc20TotalSupply() public view virtual returns (uint256) {
    return totalSupply;
  }

  function erc721TotalSupply() public view virtual returns (uint256) {
    return minted;
  }

  function getERC721QueueLength() public view virtual returns (uint256) {
    return _storedERC721Ids.length();
  }

  function getERC721TokensInQueue(uint256 start_, uint256 count_) public view virtual returns (uint256[] memory) {
    uint256[] memory tokensInQueue = new uint256[](count_);

    for (uint256 i = start_; i < start_ + count_; ) {
      tokensInQueue[i - start_] = _storedERC721Ids.at(i);

      unchecked {
        ++i;
      }
    }

    return tokensInQueue;
  }

  /// @notice tokenURI must be implemented by child contract
  function tokenURI(uint256 id_) public view virtual returns (string memory);

  /// @notice Function for token approvals
  /// @dev This function assumes the operator is attempting to approve
  ///      an ERC-721 if valueOrId_ is a possibly valid ERC-721 token id.
  ///      Unlike setApprovalForAll, spender_ must be allowed to be 0x0 so
  ///      that approval can be revoked.
  function approve(address spender_, uint256 valueOrId_) public virtual returns (bool) {
    if (_isValidTokenId(valueOrId_)) {
      erc721Approve(spender_, valueOrId_);
    } else {
      return erc20Approve(spender_, valueOrId_);
    }

    return true;
  }

  function erc721Approve(address spender_, uint256 id_) public virtual {
    // Intention is to approve as ERC-721 token (id).
    address erc721Owner = _getOwnerOf(id_);

    if (msg.sender != erc721Owner && !isApprovedForAll[erc721Owner][msg.sender]) {
      revert Unauthorized();
    }

    getApproved[id_] = spender_;

    emit ERC721Events.Approval(erc721Owner, spender_, id_);
  }

  /// @dev Providing type(uint256).max for approval value results in an
  ///      unlimited approval that is not deducted from on transfers.
  function erc20Approve(address spender_, uint256 value_) public virtual returns (bool) {
    // Prevent granting 0x0 an ERC-20 allowance.
    if (spender_ == address(0)) {
      revert InvalidSpender();
    }

    allowance[msg.sender][spender_] = value_;

    emit ERC20Events.Approval(msg.sender, spender_, value_);

    return true;
  }

  /// @notice Function for ERC-721 approvals
  function setApprovalForAll(address operator_, bool approved_) public virtual {
    // Prevent approvals to 0x0.
    if (operator_ == address(0)) {
      revert InvalidOperator();
    }
    isApprovedForAll[msg.sender][operator_] = approved_;
    emit ERC721Events.ApprovalForAll(msg.sender, operator_, approved_);
  }

  /// @notice Function for mixed transfers from an operator that may be different than 'from'.
  /// @dev This function assumes the operator is attempting to transfer an ERC-721
  ///      if valueOrId is a possible valid token id.
  function transferFrom(address from_, address to_, uint256 valueOrId_) public virtual returns (bool) {
    if (_isValidTokenId(valueOrId_)) {
      erc721TransferFrom(from_, to_, valueOrId_);
    } else {
      // Intention is to transfer as ERC-20 token (value).
      return erc20TransferFrom(from_, to_, valueOrId_);
    }

    return true;
  }

  /// @notice Function for ERC-721 transfers from.
  /// @dev This function is recommended for ERC721 transfers.
  function erc721TransferFrom(address from_, address to_, uint256 id_) public virtual {
    // Prevent minting tokens from 0x0.
    if (from_ == address(0)) {
      revert InvalidSender();
    }

    // Prevent burning tokens to 0x0.
    if (to_ == address(0)) {
      revert InvalidRecipient();
    }

    if (from_ != _getOwnerOf(id_)) {
      revert Unauthorized();
    }

    // Check that the operator is either the sender or approved for the transfer.
    if (msg.sender != from_ && !isApprovedForAll[from_][msg.sender] && msg.sender != getApproved[id_]) {
      revert Unauthorized();
    }

    // We only need to check ERC-721 transfer exempt status for the recipient
    // since the sender being ERC-721 transfer exempt means they have already
    // had their ERC-721s stripped away during the rebalancing process.
    if (erc721TransferExempt(to_)) {
      revert RecipientIsERC721TransferExempt();
    }

    // Transfer 1 * units ERC-20 and 1 ERC-721 token.
    // ERC-721 transfer exemptions handled above. Can't make it to this point if either is transfer exempt.
    _transferERC20(from_, to_, UNITS);
    _transferERC721(from_, to_, id_);
  }

  /// @notice Function for ERC-20 transfers from.
  /// @dev This function is recommended for ERC20 transfers
  function erc20TransferFrom(address from_, address to_, uint256 value_) public virtual returns (bool) {
    // Prevent minting tokens from 0x0.
    if (from_ == address(0)) {
      revert InvalidSender();
    }

    // Prevent burning tokens to 0x0.
    if (to_ == address(0)) {
      revert InvalidRecipient();
    }

    uint256 allowed = allowance[from_][msg.sender];

    // Check that the operator has sufficient allowance.
    if (allowed != type(uint256).max) {
      allowance[from_][msg.sender] = allowed - value_;
    }

    // Transferring ERC-20s directly requires the _transferERC20WithERC721 function.
    // Handles ERC-721 exemptions internally.
    return _transferERC20WithERC721(from_, to_, value_);
  }

  /// @notice Function for ERC-20 transfers.
  /// @dev This function assumes the operator is attempting to transfer as ERC-20
  ///      given this function is only supported on the ERC-20 interface.
  ///      Treats even large amounts that are valid ERC-721 ids as ERC-20s.
  function transfer(address to_, uint256 value_) public virtual returns (bool) {
    // Prevent burning tokens to 0x0.
    if (to_ == address(0)) {
      revert InvalidRecipient();
    }

    // Transferring ERC-20s directly requires the _transferERC20WithERC721 function.
    // Handles ERC-721 exemptions internally.
    return _transferERC20WithERC721(msg.sender, to_, value_);
  }

  /// @notice Function for ERC-721 transfers with contract support.
  /// This function only supports moving valid ERC-721 ids, as it does not exist on the ERC-20
  /// spec and will revert otherwise.
  function safeTransferFrom(address from_, address to_, uint256 id_) public virtual {
    safeTransferFrom(from_, to_, id_, "");
  }

  /// @notice Function for ERC-721 transfers with contract support and callback data.
  /// This function only supports moving valid ERC-721 ids, as it does not exist on the
  /// ERC-20 spec and will revert otherwise.
  function safeTransferFrom(address from_, address to_, uint256 id_, bytes memory data_) public virtual {
    if (!_isValidTokenId(id_)) {
      revert InvalidTokenId();
    }

    transferFrom(from_, to_, id_);

    if (
      to_.code.length != 0 &&
      IERC721Receiver(to_).onERC721Received(msg.sender, from_, id_, data_) != IERC721Receiver.onERC721Received.selector
    ) {
      revert UnsafeRecipient();
    }
  }

  /// @notice Function for EIP-2612 permits (ERC-20 only).
  /// @dev Providing type(uint256).max for permit value results in an
  ///      unlimited approval that is not deducted from on transfers.
  function permit(
    address owner_,
    address spender_,
    uint256 value_,
    uint256 deadline_,
    uint8 v_,
    bytes32 r_,
    bytes32 s_
  ) public virtual {
    if (deadline_ < block.timestamp) {
      revert PermitDeadlineExpired();
    }

    // permit cannot be used for ERC-721 token approvals, so ensure
    // the value does not fall within the valid range of ERC-721 token ids.
    if (_isValidTokenId(value_)) {
      revert InvalidApproval();
    }

    if (spender_ == address(0)) {
      revert InvalidSpender();
    }

    unchecked {
      address recoveredAddress = ecrecover(
        keccak256(
          abi.encodePacked(
            "\x19\x01",
            DOMAIN_SEPARATOR(),
            keccak256(
              abi.encode(
                keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"),
                owner_,
                spender_,
                value_,
                nonces[owner_]++,
                deadline_
              )
            )
          )
        ),
        v_,
        r_,
        s_
      );

      if (recoveredAddress == address(0) || recoveredAddress != owner_) {
        revert InvalidSigner();
      }

      allowance[recoveredAddress][spender_] = value_;
    }

    emit ERC20Events.Approval(owner_, spender_, value_);
  }

  /// @notice Returns domain initial domain separator, or recomputes if chain id is not equal to initial chain id
  function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
    return _initialDomainSeparator;
  }

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

  /// @notice Function for self-exemption
  function setSelfERC721TransferExempt(bool state_) public virtual {
    _setERC721TransferExempt(msg.sender, state_);
  }

  /// @notice Function to check if address is transfer exempt
  function erc721TransferExempt(address target_) public view virtual returns (bool) {
    return target_ == address(0) || _erc721TransferExempt[target_];
  }

  /// @notice For a token token id to be considered valid, it just needs
  ///         to fall within the range of possible token ids, it does not
  ///         necessarily have to be minted yet.
  function _isValidTokenId(uint256 id_) internal pure returns (bool) {
    return id_ > ID_ENCODING_PREFIX && id_ != type(uint256).max;
  }

  /// @notice Internal function to compute domain separator for EIP-2612 permits
  function _computeDomainSeparator() internal view virtual returns (bytes32) {
    return
      keccak256(
        abi.encode(
          keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
          keccak256(bytes(name)),
          keccak256("1"),
          block.chainid,
          address(this)
        )
      );
  }

  /// @notice This is the lowest level ERC-20 transfer function, which
  ///         should be used for both normal ERC-20 transfers as well as minting.
  /// Note that this function allows transfers to and from 0x0.
  function _transferERC20(address from_, address to_, uint256 value_) internal virtual {
    // Minting is a special case for which we should not check the balance of
    // the sender, and we should increase the total supply.
    if (from_ == address(0)) {
      totalSupply += value_;
    } else {
      // Deduct value from sender's balance.
      balanceOf[from_] -= value_;
    }

    // Update the recipient's balance.
    // Can be unchecked because on mint, adding to totalSupply is checked, and on transfer balance deduction is checked.
    unchecked {
      balanceOf[to_] += value_;
    }

    emit ERC20Events.Transfer(from_, to_, value_);
  }

  /// @notice Consolidated record keeping function for transferring ERC-721s.
  /// @dev Assign the token to the new owner, and remove from the old owner.
  /// Note that this function allows transfers to and from 0x0.
  /// Does not handle ERC-721 exemptions.
  function _transferERC721(address from_, address to_, uint256 id_) internal virtual {
    // If this is not a mint, handle record keeping for transfer from previous owner.
    if (from_ != address(0)) {
      // On transfer of an NFT, any previous approval is reset.
      delete getApproved[id_];

      uint256 updatedId = _owned[from_][_owned[from_].length - 1];
      if (updatedId != id_) {
        uint256 updatedIndex = _getOwnedIndex(id_);
        // update _owned for sender
        _owned[from_][updatedIndex] = updatedId;
        // update index for the moved id
        _setOwnedIndex(updatedId, updatedIndex);
      }

      // pop
      _owned[from_].pop();
    }

    // Check if this is a burn.
    if (to_ != address(0)) {
      // If not a burn, update the owner of the token to the new owner.
      // Update owner of the token to the new owner.
      _setOwnerOf(id_, to_);
      // Push token onto the new owner's stack.
      _owned[to_].push(id_);
      // Update index for new owner's stack.
      _setOwnedIndex(id_, _owned[to_].length - 1);
    } else {
      // If this is a burn, reset the owner of the token to 0x0 by deleting the token from _ownedData.
      delete _ownedData[id_];
    }

    emit ERC721Events.Transfer(from_, to_, id_);
  }

  /// @notice Internal function for ERC-20 transfers. Also handles any ERC-721 transfers that may be required.
  // Handles ERC-721 exemptions.
  function _transferERC20WithERC721(address from_, address to_, uint256 value_) internal virtual returns (bool) {
    uint256 erc20BalanceOfSenderBefore = erc20BalanceOf(from_);
    uint256 erc20BalanceOfReceiverBefore = erc20BalanceOf(to_);

    _transferERC20(from_, to_, value_);

    // Preload for gas savings on branches
    bool isFromERC721TransferExempt = erc721TransferExempt(from_);
    bool isToERC721TransferExempt = erc721TransferExempt(to_);

    // Skip _withdrawAndStoreERC721 and/or _retrieveOrMintERC721 for ERC-721 transfer exempt addresses
    // 1) to save gas
    // 2) because ERC-721 transfer exempt addresses won't always have/need ERC-721s corresponding to their ERC20s.
    if (isFromERC721TransferExempt && isToERC721TransferExempt) {
      // Case 1) Both sender and recipient are ERC-721 transfer exempt. No ERC-721s need to be transferred.
      // NOOP.
    } else if (isFromERC721TransferExempt) {
      // Case 2) The sender is ERC-721 transfer exempt, but the recipient is not. Contract should not attempt
      //         to transfer ERC-721s from the sender, but the recipient should receive ERC-721s
      //         from the bank/minted for any whole number increase in their balance.
      // Only cares about whole number increments.
      uint256 tokensToRetrieveOrMint = (balanceOf[to_] / UNITS) - (erc20BalanceOfReceiverBefore / UNITS);
      for (uint256 i = 0; i < tokensToRetrieveOrMint; ) {
        _retrieveOrMintERC721(to_);
        unchecked {
          ++i;
        }
      }
    } else if (isToERC721TransferExempt) {
      // Case 3) The sender is not ERC-721 transfer exempt, but the recipient is. Contract should attempt
      //         to withdraw and store ERC-721s from the sender, but the recipient should not
      //         receive ERC-721s from the bank/minted.
      // Only cares about whole number increments.
      uint256 tokensToWithdrawAndStore = (erc20BalanceOfSenderBefore / UNITS) - (balanceOf[from_] / UNITS);
      for (uint256 i = 0; i < tokensToWithdrawAndStore; ) {
        _withdrawAndStoreERC721(from_);
        unchecked {
          ++i;
        }
      }
    } else {
      // Case 4) Neither the sender nor the recipient are ERC-721 transfer exempt.
      // Strategy:
      // 1. First deal with the whole tokens. These are easy and will just be transferred.
      // 2. Look at the fractional part of the value:
      //   a) If it causes the sender to lose a whole token that was represented by an NFT due to a
      //      fractional part being transferred, withdraw and store an additional NFT from the sender.
      //   b) If it causes the receiver to gain a whole new token that should be represented by an NFT
      //      due to receiving a fractional part that completes a whole token, retrieve or mint an NFT to the recevier.

      // Whole tokens worth of ERC-20s get transferred as ERC-721s without any burning/minting.
      uint256 nftsToTransfer = value_ / UNITS;
      for (uint256 i = 0; i < nftsToTransfer; ) {
        // Pop from sender's ERC-721 stack and transfer them (LIFO)
        uint256 indexOfLastToken = _owned[from_].length - 1;
        uint256 tokenId = _owned[from_][indexOfLastToken];
        _transferERC721(from_, to_, tokenId);
        unchecked {
          ++i;
        }
      }

      // If the transfer changes either the sender or the recipient's holdings from a fractional to a non-fractional
      // amount (or vice versa), adjust ERC-721s.

      // First check if the send causes the sender to lose a whole token that was represented by an ERC-721
      // due to a fractional part being transferred.
      //
      // Process:
      // Take the difference between the whole number of tokens before and after the transfer for the sender.
      // If that difference is greater than the number of ERC-721s transferred (whole units), then there was
      // an additional ERC-721 lost due to the fractional portion of the transfer.
      // If this is a self-send and the before and after balances are equal (not always the case but often),
      // then no ERC-721s will be lost here.
      if (erc20BalanceOfSenderBefore / UNITS - erc20BalanceOf(from_) / UNITS > nftsToTransfer) {
        _withdrawAndStoreERC721(from_);
      }

      // Then, check if the transfer causes the receiver to gain a whole new token which requires gaining
      // an additional ERC-721.
      //
      // Process:
      // Take the difference between the whole number of tokens before and after the transfer for the recipient.
      // If that difference is greater than the number of ERC-721s transferred (whole units), then there was
      // an additional ERC-721 gained due to the fractional portion of the transfer.
      // Again, for self-sends where the before and after balances are equal, no ERC-721s will be gained here.
      if (erc20BalanceOf(to_) / UNITS - erc20BalanceOfReceiverBefore / UNITS > nftsToTransfer) {
        _retrieveOrMintERC721(to_);
      }
    }

    return true;
  }

  /// @notice Internal function for ERC20 minting
  /// @dev This function will allow minting of new ERC20s.
  ///      If mintCorrespondingERC721s_ is true, and the recipient is not ERC-721 exempt, it will
  ///      also mint the corresponding ERC721s.
  /// Handles ERC-721 exemptions.
  function _mintERC20(address to_, uint256 value_) internal virtual {
    /// You cannot mint to the zero address (you can't mint and immediately burn in the same transfer).
    if (to_ == address(0)) {
      revert InvalidRecipient();
    }

    if (totalSupply + value_ > ID_ENCODING_PREFIX) {
      revert MintLimitReached();
    }

    _transferERC20WithERC721(address(0), to_, value_);
  }

  /// @notice Internal function for ERC-721 minting and retrieval from the bank.
  /// @dev This function will allow minting of new ERC-721s up to the total fractional supply. It will
  ///      first try to pull from the bank, and if the bank is empty, it will mint a new token.
  /// Does not handle ERC-721 exemptions.
  function _retrieveOrMintERC721(address to_) internal virtual {
    if (to_ == address(0)) {
      revert InvalidRecipient();
    }

    uint256 id;

    if (!_storedERC721Ids.empty()) {
      // If there are any tokens in the bank, use those first.
      // Pop off the end of the queue (FIFO).
      id = _storedERC721Ids.popBack();
    } else {
      // Otherwise, mint a new token, should not be able to go over the total fractional supply.
      ++minted;

      // Reserve max uint256 for approvals
      if (minted == type(uint256).max) {
        revert MintLimitReached();
      }

      id = ID_ENCODING_PREFIX + minted;
    }

    address erc721Owner = _getOwnerOf(id);

    // The token should not already belong to anyone besides 0x0 or this contract.
    // If it does, something is wrong, as this should never happen.
    if (erc721Owner != address(0)) {
      revert AlreadyExists();
    }

    // Transfer the token to the recipient, either transferring from the contract's bank or minting.
    // Does not handle ERC-721 exemptions.
    _transferERC721(erc721Owner, to_, id);
  }

  /// @notice Internal function for ERC-721 deposits to bank (this contract).
  /// @dev This function will allow depositing of ERC-721s to the bank, which can be retrieved by future minters.
  // Does not handle ERC-721 exemptions.
  function _withdrawAndStoreERC721(address from_) internal virtual {
    if (from_ == address(0)) {
      revert InvalidSender();
    }

    // Retrieve the latest token added to the owner's stack (LIFO).
    uint256 id = _owned[from_][_owned[from_].length - 1];

    // Transfer to 0x0.
    // Does not handle ERC-721 exemptions.
    _transferERC721(from_, address(0), id);

    // Record the token in the contract's bank queue.
    _storedERC721Ids.pushFront(id);
  }

  /// @notice Initialization function to set pairs / etc, saving gas by avoiding mint / burn on unnecessary targets
  function _setERC721TransferExempt(address target_, bool state_) internal virtual {
    if (target_ == address(0)) {
      revert InvalidExemption();
    }

    // Adjust the ERC721 balances of the target to respect exemption rules.
    // Despite this logic, it is still recommended practice to exempt prior to the target
    // having an active balance.
    if (state_) {
      _clearERC721Balance(target_);
    } else {
      _reinstateERC721Balance(target_);
    }

    _erc721TransferExempt[target_] = state_;
  }

  /// @notice Function to reinstate balance on exemption removal
  function _reinstateERC721Balance(address target_) private {
    uint256 expectedERC721Balance = erc20BalanceOf(target_) / UNITS;
    uint256 actualERC721Balance = erc721BalanceOf(target_);

    for (uint256 i = 0; i < expectedERC721Balance - actualERC721Balance; ) {
      // Transfer ERC721 balance in from pool
      _retrieveOrMintERC721(target_);
      unchecked {
        ++i;
      }
    }
  }

  /// @notice Function to clear balance on exemption inclusion
  function _clearERC721Balance(address target_) private {
    uint256 erc721Balance = erc721BalanceOf(target_);

    for (uint256 i = 0; i < erc721Balance; ) {
      // Transfer out ERC721 balance
      _withdrawAndStoreERC721(target_);
      unchecked {
        ++i;
      }
    }
  }

  function _getOwnerOf(uint256 id_) internal view virtual returns (address ownerOf_) {
    uint256 data = _ownedData[id_];

    assembly {
      ownerOf_ := and(data, _BITMASK_ADDRESS)
    }
  }

  function _setOwnerOf(uint256 id_, address owner_) internal virtual {
    uint256 data = _ownedData[id_];

    assembly {
      data := add(and(data, _BITMASK_OWNED_INDEX), and(owner_, _BITMASK_ADDRESS))
    }

    _ownedData[id_] = data;
  }

  function _getOwnedIndex(uint256 id_) internal view virtual returns (uint256 ownedIndex_) {
    uint256 data = _ownedData[id_];

    assembly {
      ownedIndex_ := shr(160, data)
    }
  }

  function _setOwnedIndex(uint256 id_, uint256 index_) internal virtual {
    uint256 data = _ownedData[id_];

    if (index_ > _BITMASK_OWNED_INDEX >> 160) {
      revert OwnedIndexOverflow();
    }

    assembly {
      data := add(and(data, _BITMASK_ADDRESS), and(shl(160, index_), _BITMASK_OWNED_INDEX))
    }

    _ownedData[id_] = data;
  }
}

File 24 of 30 : IERC404.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

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

interface IERC404 is IERC165 {
  error NotFound();
  error InvalidTokenId();
  error AlreadyExists();
  error InvalidRecipient();
  error InvalidSender();
  error InvalidSpender();
  error InvalidOperator();
  error UnsafeRecipient();
  error RecipientIsERC721TransferExempt();
  error Unauthorized();
  error InsufficientAllowance();
  error PermitDeadlineExpired();
  error InvalidSigner();
  error InvalidApproval();
  error OwnedIndexOverflow();
  error MintLimitReached();
  error InvalidExemption();

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

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

  function decimals() external view returns (uint8);

  function totalSupply() external view returns (uint256);

  function erc20TotalSupply() external view returns (uint256);

  function erc721TotalSupply() external view returns (uint256);

  function balanceOf(address owner_) external view returns (uint256);

  function erc721BalanceOf(address owner_) external view returns (uint256);

  function erc20BalanceOf(address owner_) external view returns (uint256);

  function erc721TransferExempt(address account_) external view returns (bool);

  function isApprovedForAll(address owner_, address operator_) external view returns (bool);

  function allowance(address owner_, address spender_) external view returns (uint256);

  function owned(address owner_) external view returns (uint256[] memory);

  function ownerOf(uint256 id_) external view returns (address erc721Owner);

  function tokenURI(uint256 id_) external view returns (string memory);

  function approve(address spender_, uint256 valueOrId_) external returns (bool);

  function erc20Approve(address spender_, uint256 value_) external returns (bool);

  function erc721Approve(address spender_, uint256 id_) external;

  function setApprovalForAll(address operator_, bool approved_) external;

  function transferFrom(address from_, address to_, uint256 valueOrId_) external returns (bool);

  function erc20TransferFrom(address from_, address to_, uint256 value_) external returns (bool);

  function erc721TransferFrom(address from_, address to_, uint256 id_) external;

  function transfer(address to_, uint256 amount_) external returns (bool);

  function getERC721QueueLength() external view returns (uint256);

  function getERC721TokensInQueue(uint256 start_, uint256 count_) external view returns (uint256[] memory);

  function setSelfERC721TransferExempt(bool state_) external;

  function safeTransferFrom(address from_, address to_, uint256 id_) external;

  function safeTransferFrom(address from_, address to_, uint256 id_, bytes calldata data_) external;

  function DOMAIN_SEPARATOR() external view returns (bytes32);

  function permit(
    address owner_,
    address spender_,
    uint256 value_,
    uint256 deadline_,
    uint8 v_,
    bytes32 r_,
    bytes32 s_
  ) external;
}

File 25 of 30 : DoubleEndedQueue.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/DoubleEndedQueue.sol)
// Modified by Pandora Labs to support native uint256 operations
pragma solidity ^0.8.8;

/**
 * @dev A sequence of items with the ability to efficiently push and pop items (i.e. insert and remove) on both ends of
 * the sequence (called front and back). Among other access patterns, it can be used to implement efficient LIFO and
 * FIFO queues. Storage use is optimized, and all operations are O(1) constant time. This includes {clear}, given that
 * the existing queue contents are left in storage.
 *
 * The struct is called `Uint256Deque`. This data structure can only be used in storage, and not in memory.
 *
 * ```solidity
 * DoubleEndedQueue.Uint256Deque queue;
 * ```
 */
library DoubleEndedQueue {
  /**
   * @dev An operation (e.g. {front}) couldn't be completed due to the queue being empty.
   */
  error QueueEmpty();

  /**
   * @dev A push operation couldn't be completed due to the queue being full.
   */
  error QueueFull();

  /**
   * @dev An operation (e.g. {at}) couldn't be completed due to an index being out of bounds.
   */
  error QueueOutOfBounds();

  /**
   * @dev Indices are 128 bits so begin and end are packed in a single storage slot for efficient access.
   *
   * Struct members have an underscore prefix indicating that they are "private" and should not be read or written to
   * directly. Use the functions provided below instead. Modifying the struct manually may violate assumptions and
   * lead to unexpected behavior.
   *
   * The first item is at data[begin] and the last item is at data[end - 1]. This range can wrap around.
   */
  struct Uint256Deque {
    uint128 _begin;
    uint128 _end;
    mapping(uint128 index => uint256) _data;
  }

  /**
   * @dev Inserts an item at the end of the queue.
   *
   * Reverts with {QueueFull} if the queue is full.
   */
  function pushBack(Uint256Deque storage deque, uint256 value) internal {
    unchecked {
      uint128 backIndex = deque._end;
      if (backIndex + 1 == deque._begin) revert QueueFull();
      deque._data[backIndex] = value;
      deque._end = backIndex + 1;
    }
  }

  /**
   * @dev Removes the item at the end of the queue and returns it.
   *
   * Reverts with {QueueEmpty} if the queue is empty.
   */
  function popBack(Uint256Deque storage deque) internal returns (uint256 value) {
    unchecked {
      uint128 backIndex = deque._end;
      if (backIndex == deque._begin) revert QueueEmpty();
      --backIndex;
      value = deque._data[backIndex];
      delete deque._data[backIndex];
      deque._end = backIndex;
    }
  }

  /**
   * @dev Inserts an item at the beginning of the queue.
   *
   * Reverts with {QueueFull} if the queue is full.
   */
  function pushFront(Uint256Deque storage deque, uint256 value) internal {
    unchecked {
      uint128 frontIndex = deque._begin - 1;
      if (frontIndex == deque._end) revert QueueFull();
      deque._data[frontIndex] = value;
      deque._begin = frontIndex;
    }
  }

  /**
   * @dev Removes the item at the beginning of the queue and returns it.
   *
   * Reverts with `QueueEmpty` if the queue is empty.
   */
  function popFront(Uint256Deque storage deque) internal returns (uint256 value) {
    unchecked {
      uint128 frontIndex = deque._begin;
      if (frontIndex == deque._end) revert QueueEmpty();
      value = deque._data[frontIndex];
      delete deque._data[frontIndex];
      deque._begin = frontIndex + 1;
    }
  }

  /**
   * @dev Returns the item at the beginning of the queue.
   *
   * Reverts with `QueueEmpty` if the queue is empty.
   */
  function front(Uint256Deque storage deque) internal view returns (uint256 value) {
    if (empty(deque)) revert QueueEmpty();
    return deque._data[deque._begin];
  }

  /**
   * @dev Returns the item at the end of the queue.
   *
   * Reverts with `QueueEmpty` if the queue is empty.
   */
  function back(Uint256Deque storage deque) internal view returns (uint256 value) {
    if (empty(deque)) revert QueueEmpty();
    unchecked {
      return deque._data[deque._end - 1];
    }
  }

  /**
   * @dev Return the item at a position in the queue given by `index`, with the first item at 0 and last item at
   * `length(deque) - 1`.
   *
   * Reverts with `QueueOutOfBounds` if the index is out of bounds.
   */
  function at(Uint256Deque storage deque, uint256 index) internal view returns (uint256 value) {
    if (index >= length(deque)) revert QueueOutOfBounds();
    // By construction, length is a uint128, so the check above ensures that index can be safely downcast to uint128
    unchecked {
      return deque._data[deque._begin + uint128(index)];
    }
  }

  /**
   * @dev Resets the queue back to being empty.
   *
   * NOTE: The current items are left behind in storage. This does not affect the functioning of the queue, but misses
   * out on potential gas refunds.
   */
  function clear(Uint256Deque storage deque) internal {
    deque._begin = 0;
    deque._end = 0;
  }

  /**
   * @dev Returns the number of items in the queue.
   */
  function length(Uint256Deque storage deque) internal view returns (uint256) {
    unchecked {
      return uint256(deque._end - deque._begin);
    }
  }

  /**
   * @dev Returns true if the queue is empty.
   */
  function empty(Uint256Deque storage deque) internal view returns (bool) {
    return deque._end == deque._begin;
  }
}

File 26 of 30 : ERC20Events.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

library ERC20Events {
  event Approval(address indexed owner, address indexed spender, uint256 value);
  event Transfer(address indexed from, address indexed to, uint256 amount);
}

File 27 of 30 : ERC721Events.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

library ERC721Events {
  event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
  event Approval(address indexed owner, address indexed spender, uint256 indexed id);
  event Transfer(address indexed from, address indexed to, uint256 indexed id);
}

File 28 of 30 : IFactoryNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

interface IFactoryNFT {
  function initialize(
    address registry,
    address launchpad,
    string calldata baseTokenURI,
    string calldata nftName,
    string calldata nftSymbol,
    uint16 royaltyBps,
    address royaltyRecipient,
    address owner
  ) external;
}

File 29 of 30 : Registry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

// This is a contract that is shared with all the NFT beacon proxies to upgrade them with some shared state
contract Registry is UUPSUpgradeable, OwnableUpgradeable {
  /// @custom:oz-upgrades-unsafe-allow constructor
  constructor() {
    _disableInitializers();
  }

  function initialize() external initializer {
    __UUPSUpgradeable_init();
    __Ownable_init(_msgSender());
  }

  // solhint-disable-next-line no-empty-blocks
  function _authorizeUpgrade(address newImplementation) internal override onlyOwner {}
}

File 30 of 30 : ILaunchpadNFT.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ILaunchpadNFT
/// @notice Interface for NFT contracts to be compatible with the Launchpad platform
/// @dev Any NFT contract that wants to be launched through the Launchpad must implement this interface
interface ILaunchpadNFT {
  /// @notice Mints NFTs to a specified address
  /// @dev Must return the actual token IDs that were minted, which may differ from requested IDs (w/ erc404's for instane)
  /// @param to The address to mint the NFTs to
  /// @param tokenIds Array of requested token IDs to mint
  /// @param amounts Array of amounts to mint for each token ID
  /// @return mintedTokenIds Array of the actual token IDs that were minted
  function mint(
    address to,
    uint256[] calldata tokenIds,
    uint256[] calldata amounts
  ) external returns (uint256[] memory mintedTokenIds, uint256[] memory mintedAmounts);

  /// @notice Sets the base token URI for the NFT collection
  /// @dev Used to update the metadata URI for the entire collection
  /// @param baseTokenURI The new base URI to set
  function setDetails(string calldata baseTokenURI) external;

  /// @notice Hook called after funds are claimed post-mint
  /// @dev Can be used to enable additional functionality like ERC20 transfers in ERC404 tokens
  /// @dev Don't revert else fees cannot be claimed!
  function claimedHook() external;
}

Settings
{
  "evmVersion": "cancun",
  "optimizer": {
    "enabled": true,
    "runs": 9999999,
    "details": {
      "yul": true
    }
  },
  "viaIR": true,
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyExists","type":"error"},{"inputs":[],"name":"ERC20TransfersNotAllowedYet","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC404NonexistentToken","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InvalidApproval","type":"error"},{"inputs":[],"name":"InvalidExemption","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidOperator","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidSender","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidSpender","type":"error"},{"inputs":[],"name":"InvalidTokenId","type":"error"},{"inputs":[],"name":"MintLimitReached","type":"error"},{"inputs":[],"name":"NotFound","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotLaunchpad","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"OwnedIndexOverflow","type":"error"},{"inputs":[],"name":"PermitDeadlineExpired","type":"error"},{"inputs":[],"name":"QueueEmpty","type":"error"},{"inputs":[],"name":"QueueFull","type":"error"},{"inputs":[],"name":"QueueOutOfBounds","type":"error"},{"inputs":[],"name":"RecipientIsERC721TransferExempt","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnsafeRecipient","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","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":"uint64","name":"version","type":"uint64"}],"name":"Initialized","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":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","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":"id","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ID_ENCODING_PREFIX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNITS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender_","type":"address"},{"internalType":"uint256","name":"valueOrId_","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimedHook","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender_","type":"address"},{"internalType":"uint256","name":"value_","type":"uint256"}],"name":"erc20Approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"name":"erc20BalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc20TotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from_","type":"address"},{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"value_","type":"uint256"}],"name":"erc20TransferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender_","type":"address"},{"internalType":"uint256","name":"id_","type":"uint256"}],"name":"erc721Approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"name":"erc721BalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc721TotalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"target_","type":"address"}],"name":"erc721TransferExempt","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from_","type":"address"},{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"id_","type":"uint256"}],"name":"erc721TransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getERC721QueueLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"start_","type":"uint256"},{"internalType":"uint256","name":"count_","type":"uint256"}],"name":"getERC721TokensInQueue","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"registry","type":"address"},{"internalType":"address","name":"launchpad","type":"address"},{"internalType":"string","name":"baseTokenURI","type":"string"},{"internalType":"string","name":"nftName","type":"string"},{"internalType":"string","name":"nftSymbol","type":"string"},{"internalType":"uint16","name":"royaltyBps","type":"uint16"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"address","name":"contractOwner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"name":"mint","outputs":[{"internalType":"uint256[]","name":"mintedTokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"mintedAmounts","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"}],"name":"owned","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"erc721Owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner_","type":"address"},{"internalType":"address","name":"spender_","type":"address"},{"internalType":"uint256","name":"value_","type":"uint256"},{"internalType":"uint256","name":"deadline_","type":"uint256"},{"internalType":"uint8","name":"v_","type":"uint8"},{"internalType":"bytes32","name":"r_","type":"bytes32"},{"internalType":"bytes32","name":"s_","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from_","type":"address"},{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"id_","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":"id_","type":"uint256"},{"internalType":"bytes","name":"data_","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator_","type":"address"},{"internalType":"bool","name":"approved_","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseTokenURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseTokenURI","type":"string"}],"name":"setDetails","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"royaltyBps","type":"uint16"},{"internalType":"address","name":"royaltyRecipient","type":"address"}],"name":"setRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"state_","type":"bool"}],"name":"setSelfERC721TransferExempt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from_","type":"address"},{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"valueOrId_","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6080604052346101875761001161018b565b61001961018b565b466008556040515f906004548060011c906001811693841561017d575b6020831085146101695782845260208401948492811561014d57506001146100ee575b61006592500382610221565b51902060405160208101917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f835260408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a081526100d960c082610221565b5190206009556040516144b190816102598239f35b5060045f90815290917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b81831061013157505090602061006592820101610059565b6020919350806001915483858801015201910190918392610119565b60ff191686525061006592151560051b82016020019050610059565b634e487b7160e01b5f52602260045260245ffd5b91607f1691610036565b5f80fd5b5f51602061470a5f395f51905f525460ff8160401c16610212576002600160401b03196001600160401b038216016101c05750565b6001600160401b0319166001600160401b039081175f51602061470a5f395f51905f52556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d290602090a1565b63f92ee8a960e01b5f5260045ffd5b601f909101601f19168101906001600160401b0382119082101761024457604052565b634e487b7160e01b5f52604160045260245ffdfe6080806040526004361015610012575f80fd5b5f3560e01c90816301ffc9a7146126415750806302519da31461162e5780630608bdf8146125a757806306fdde03146124e4578063081812fc14612486578063095ea7b31461244157806309674eb0146123e657806309f0ef65146123a557806312d27371146119f257806318160ddd1461147557806323b872dd146119d95780632a55205a1461198c578063313ce567146119535780633644e515146119185780633e8a8009146118a157806342842e0e146118785780634d966072146118335780634f02c42014610c1257806355f804b3146117d35780635fda96e8146117435780636352211e146116e95780636e8f624b1461169157806370a082311461162e578063715018a61461155457806377fe143f146115135780637ecebe00146114b057806389fb4c66146114755780638a696e50146113365780638da5cb5b146112c657806395d89b41146111c05780639727756a14610fa3578063a22cb46514610ea0578063a9059cbb14610ddf578063b1ab931714610d2e578063b3f9ea3414610ccb578063b88d4fde14610c4d578063c5ab3ba614610c12578063c87b56dd146107f3578063d505accf14610508578063d96ca0b9146104e5578063dd62ed3e14610459578063dd63769914610442578063dfabc033146103ff578063e985e9c51461036e578063f2fde38b146103255763f780bc1a14610216575f80fd5b34610321576102243661297e565b61022d81612f09565b91806102526fffffffffffffffffffffffffffffffff6002548181169060801c031690565b6fffffffffffffffffffffffffffffffff60025416915b6102738585612f85565b81101561030757818110156102df576001816102c26fffffffffffffffffffffffffffffffff8061027395168701166fffffffffffffffffffffffffffffffff165f52600360205260405f2090565b546102d66102d088846131c3565b8a612f92565b52019050610269565b7f580821e7000000000000000000000000000000000000000000000000000000005f5260045ffd5b6040516020808252819061031d90820189612a27565b0390f35b5f80fd5b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215761036c61035f6127c3565b61036761362c565b61353f565b005b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576103a56127c3565b73ffffffffffffffffffffffffffffffffffffffff6103c26127e6565b91165f52600d60205273ffffffffffffffffffffffffffffffffffffffff60405f2091165f52602052602060ff60405f2054166040519015158152f35b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215761036c6104396127c3565b60243590613449565b346103215761036c6104533661290c565b916132d4565b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576104906127c3565b73ffffffffffffffffffffffffffffffffffffffff6104ad6127e6565b91165f52600b60205273ffffffffffffffffffffffffffffffffffffffff60405f2091165f52602052602060405f2054604051908152f35b346103215760206104fe6104f83661290c565b916131d0565b6040519015158152f35b346103215760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215761053f6127c3565b6105476127e6565b90604435606435916084359360ff8516809503610321574284106107cb577f80000000000000000000000000000000000000000000000000000000000000008311806107a1575b6107795773ffffffffffffffffffffffffffffffffffffffff169384156107515760805f9160209373ffffffffffffffffffffffffffffffffffffffff60095491169687855260118652604085209081549160018301905560405190878201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c984528a60408401528b6060840152898784015260a083015260c082015260c0815261063b60e08261285a565b51902060405190868201927f19010000000000000000000000000000000000000000000000000000000000008452602283015260428201526042815261068260628261285a565b519020906040519182528482015260a435604082015260c435606082015282805260015afa156107465773ffffffffffffffffffffffffffffffffffffffff5f51168015801561073c575b610714577f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925916020915f52600b825260405f20855f5282528060405f2055604051908152a3005b7f815e1d64000000000000000000000000000000000000000000000000000000005f5260045ffd5b50828114156106cd565b6040513d5f823e3d90fd5b7f5461585f000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f1f3e0de8000000000000000000000000000000000000000000000000000000005f5260045ffd5b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83141561058e565b7f05787bdf000000000000000000000000000000000000000000000000000000005f5260045ffd5b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760043573ffffffffffffffffffffffffffffffffffffffff61084382612e15565b1615610be75760405160155490915f8361085c84612809565b9182825260208201946001811690815f14610bad5750600114610b4e575b6108869250038461285a565b7f80000000000000000000000000000000000000000000000000000000000000008101908111610b21575f81807a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000811015610af6575b50806d04ee2d6d415b85acef8100000000600a921015610adb575b662386f26fc10000811015610ac7575b6305f5e100811015610ab6575b612710811015610aa7575b6064811015610a99575b1015610a91575b6001810191600a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602161097761096187612a5a565b9661096f604051988961285a565b808852612a5a565b947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06020880196013687378601015b01917f30313233343536373839616263646566000000000000000000000000000000008282061a835304908115610a0157600a907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff906109a6565b61031d85610a7d6005896020888a6040519687945180918587015e840190838201905f8252519283915e01017f2e6a736f6e0000000000000000000000000000000000000000000000000000008152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe581018452018261285a565b60405191829160208352602083019061289b565b60010161092b565b606460029104920191610924565b6127106004910492019161091a565b6305f5e1006008910492019161090f565b662386f26fc1000060109104920191610902565b6d04ee2d6d415b85acef8100000000602091049201916108f2565b604092507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000090049050600a6108d7565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5060155f90815290917f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec4755b818310610b915750509060206108869282010161087a565b6020919350806001915483858a01015201910190918592610b79565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686525061088692151560051b8201602001905061087a565b7fc5f05383000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576020600754604051908152f35b346103215760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157610c846127c3565b610c8c6127e6565b6064359167ffffffffffffffff8311610321573660238401121561032157610cc161036c933690602481600401359101612a94565b9160443591612fd3565b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215773ffffffffffffffffffffffffffffffffffffffff610d176127c3565b165f52600f602052602060405f2054604051908152f35b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215773ffffffffffffffffffffffffffffffffffffffff610d7a6127c3565b165f52600f60205260405f206040519081602082549182815201915f5260205f20905f5b818110610dc95761031d85610db58187038261285a565b604051918291602083526020830190612a27565b8254845260209093019260019283019201610d9e565b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157610e166127c3565b60ff60125460b01c1615610e785773ffffffffffffffffffffffffffffffffffffffff811615610e50576104fe602091602435903361390c565b7f9c8d2cd2000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd12753b7000000000000000000000000000000000000000000000000000000005f5260045ffd5b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157610ed76127c3565b60243590811515908183036103215773ffffffffffffffffffffffffffffffffffffffff16918215610f7b57610f4d90335f52600d60205260405f20845f5260205260405f209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b6040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b7fccea9e6f000000000000000000000000000000000000000000000000000000005f5260045ffd5b346103215760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157610fda6127c3565b60243567ffffffffffffffff811161032157610ffa9036906004016129ca565b60443567ffffffffffffffff81116103215761101a9036906004016129ca565b5073ffffffffffffffffffffffffffffffffffffffff6013541633036111985761104e8151670de0b6b3a764000090612be0565b916110598251612f09565b926110648351612f09565b91600754915f925b85518410156110eb5761107e90612f58565b92837f80000000000000000000000000000000000000000000000000000000000000000190817f800000000000000000000000000000000000000000000000000000000000000011610b21576001916110d7828a612f92565b52816110e38288612f92565b52019261106c565b5085908473ffffffffffffffffffffffffffffffffffffffff841615610e50577f800000000000000000000000000000000000000000000000000000000000000061113883600654612f85565b116111705761114d61031d92611162956136ad565b50604051938493604085526040850190612a27565b908382036020850152612a27565b7f303b682f000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fed6fcad9000000000000000000000000000000000000000000000000000000005f5260045ffd5b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576040515f6005546111fe81612809565b80845290600181169081156112845750600114611226575b61031d83610a7d8185038261285a565b60055f9081527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0939250905b80821061126a57509091508101602001610a7d611216565b919260018160209254838588010152019101909291611252565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660208086019190915291151560051b84019091019150610a7d9050611216565b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157602073ffffffffffffffffffffffffffffffffffffffff7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005416604051908152f35b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157600435801515810361032157331561144d5780156113e857335f52600f60205260405f20545f5b8181106113d657505061036c905b335f52601060205260405f209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b6001906113e233613f18565b0161138c565b335f52600a60205261140760405f2054670de0b6b3a764000090612bf3565b90335f52600f60205260405f20545f5b61142182856131c3565b81101561144157906001611421926114383361417a565b01909150611417565b505061036c915061139a565b7fa41e3d3f000000000000000000000000000000000000000000000000000000005f5260045ffd5b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576020600654604051908152f35b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215773ffffffffffffffffffffffffffffffffffffffff6114fc6127c3565b165f526011602052602060405f2054604051908152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576020670de0b6b3a7640000604051908152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215761158a61362c565b5f73ffffffffffffffffffffffffffffffffffffffff7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300547fffffffffffffffffffffffff000000000000000000000000000000000000000081167f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215773ffffffffffffffffffffffffffffffffffffffff61167a6127c3565b165f52600a602052602060405f2054604051908152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760206040517f80000000000000000000000000000000000000000000000000000000000000008152f35b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576020611725600435612e15565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215773ffffffffffffffffffffffffffffffffffffffff60135416330361119857601280547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16760100000000000000000000000000000000000000000000179055005b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760043567ffffffffffffffff81116103215761182561036c9136906004016128de565b9061182e61362c565b612c7a565b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760206104fe61186f6127c3565b60243590612daf565b346103215761036c6118893661290c565b906040519261189960208561285a565b5f8452612fd3565b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760043567ffffffffffffffff8111610321576118f09036906004016128de565b73ffffffffffffffffffffffffffffffffffffffff6013541633036111985761036c91612c7a565b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576020600954604051908152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157602060405160128152f35b3461032157604061199c3661297e565b90506127106119b36012549261ffff841690612be0565b0473ffffffffffffffffffffffffffffffffffffffff83519260101c1682526020820152f35b346103215760206104fe6119ec3661290c565b91612b74565b34610321576101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157611a2a6127c3565b611a326127e6565b60443567ffffffffffffffff811161032157611a529036906004016128de565b91909260643567ffffffffffffffff811161032157611a759036906004016128de565b93909160843567ffffffffffffffff811161032157611a989036906004016128de565b5f9591955060a4359461ffff86168096036103215760c4359673ffffffffffffffffffffffffffffffffffffffff881688036103215760e43573ffffffffffffffffffffffffffffffffffffffff81168103610321577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00549260ff8460401c16159a67ffffffffffffffff85168015908161239d575b6001149081612393575b15908161238a575b5061236257611bb7611bbe93868e60017fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000611bc69a16177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005561230d575b50611ba7613ec1565b611baf613ec1565b610367613ec1565b3691612a94565b923691612a94565b90611bcf613ec1565b611bd7613ec1565b80519067ffffffffffffffff821161201257611bf4600454612809565b601f81116122aa575b50602090601f83116001146121ea57611c4b92915f91836121df575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b6004555b80519067ffffffffffffffff821161201257611c6c600554612809565b601f8111612199575b50602090601f83116001146120d957611cc292915f91836120ce5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b6005555b46600855604051600454905f611cdb83612809565b808352602083019360018116908115612097575060011461203f575b509181611d1e73ffffffffffffffffffffffffffffffffffffffff9695938795038261285a565b51902060405160208101917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f835260408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a08152611d9260c08261285a565b519020600955611da0613ec1565b167fffffffffffffffffffffffff00000000000000000000000000000000000000006013541617601355167fffffffffffffffffffffffff0000000000000000000000000000000000000000601454161760145567ffffffffffffffff811161201257611e1781611e12601554612809565b612c2a565b5f601f8211600114611f53578190611e64939495965f92611f485750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b6015555b7fffffffffffffffffffff0000000000000000000000000000000000000000000075ffffffffffffffffffffffffffffffffffffffff00006012549360101b1692161717601255611eb557005b7fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054167ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b013590508680611c19565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082169560155f527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475915f5b888110611ffa57508360019596979810611fc2575b505050811b01601555611e68565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88560031b161c19910135169055858080611fb4565b90926020600181928686013581550194019101611f9f565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60045f90815291507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b81831061207d575050810160200181611cf7565b600181602092949394548385880101520191019190612069565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016855250151560051b8201602001905081611cf7565b015190508a80611c19565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe083169160055f527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0925f5b818110612181575090846001959493921061214a575b505050811b01600555611cc6565b01517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c1916905589808061213c565b92936020600181928786015181550195019301612126565b60055f5260205f20601f840160051c810191602085106121d5575b601f0160051c01905b8181106121ca5750611c75565b5f81556001016121bd565b90915081906121b4565b015190508b80611c19565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe083169160045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b925f5b818110612292575090846001959493921061225b575b505050811b01600455611c4f565b01517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c191690558a808061224d565b92936020600181928786015181550195019301612237565b60045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f840160051c81019160208510612303575b601f0160051c01905b8181106122f85750611bfd565b5f81556001016122eb565b90915081906122e2565b7fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000001668010000000000000001177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00558f611b9e565b7ff92ee8a9000000000000000000000000000000000000000000000000000000005f5260045ffd5b9050158e611b40565b303b159150611b38565b8d9150611b2e565b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760206104fe6123e16127c3565b612b3d565b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760206124396fffffffffffffffffffffffffffffffff6002548181169060801c031690565b604051908152f35b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760206104fe61247d6127c3565b60243590612aca565b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576004355f52600c602052602073ffffffffffffffffffffffffffffffffffffffff60405f205416604051908152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576040515f60045461252281612809565b808452906001811690811561128457506001146125495761031d83610a7d8185038261285a565b60045f9081527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b939250905b80821061258d57509091508101602001610a7d611216565b919260018160209254838588010152019101909291612575565b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760043561ffff8116809103610321576125ed6127e6565b906125f661362c565b7fffffffffffffffffffff0000000000000000000000000000000000000000000075ffffffffffffffffffffffffffffffffffffffff00006012549360101b16921617176012555f80f35b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157600435907fffffffff00000000000000000000000000000000000000000000000000000000821680920361032157817ff677638b0000000000000000000000000000000000000000000000000000000060209314908115612799575b811561276f575b8115612745575b81156126e8575b5015158152f35b7fcaf91ff50000000000000000000000000000000000000000000000000000000081149150811561271b575b50836126e1565b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501483612714565b7f2a55205a00000000000000000000000000000000000000000000000000000000811491506126da565b7f5b5e139f00000000000000000000000000000000000000000000000000000000811491506126d3565b7f80ac58cd00000000000000000000000000000000000000000000000000000000811491506126cc565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361032157565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361032157565b90600182811c92168015612850575b602083101461282357565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b91607f1691612818565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761201257604052565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602080948051918291828752018686015e5f8582860101520116010190565b9181601f840112156103215782359167ffffffffffffffff8311610321576020838186019501011161032157565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60609101126103215760043573ffffffffffffffffffffffffffffffffffffffff81168103610321579060243573ffffffffffffffffffffffffffffffffffffffff81168103610321579060443590565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040910112610321576004359060243590565b67ffffffffffffffff81116120125760051b60200190565b9080601f830112156103215781356129e1816129b2565b926129ef604051948561285a565b81845260208085019260051b82010192831161032157602001905b828210612a175750505090565b8135815260209182019101612a0a565b90602080835192838152019201905f5b818110612a445750505090565b8251845260209384019390920191600101612a37565b67ffffffffffffffff811161201257601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b929192612aa082612a5a565b91612aae604051938461285a565b829481845281830111610321578281602093845f960137010152565b907f8000000000000000000000000000000000000000000000000000000000000000811180612b13575b15612b0757612b0291613449565b600190565b612b1091612daf565b90565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811415612af4565b73ffffffffffffffffffffffffffffffffffffffff168015908115612b60575090565b90505f52601060205260ff60405f20541690565b91907f8000000000000000000000000000000000000000000000000000000000000000821180612bb6575b15612bad57612b02926132d4565b612b10926131d0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612b9f565b81810292918115918404141715610b2157565b8115612bfd570490565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b601f8111612c36575050565b60155f5260205f20906020601f840160051c83019310612c70575b601f0160051c01905b818110612c65575050565b5f8155600101612c5a565b9091508190612c51565b919067ffffffffffffffff811161201257612c9a81611e12601554612809565b5f601f8211600114612cf5578190612ce593945f92612cea5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b601555565b013590505f80611c19565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082169360155f527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475915f5b868110612d975750836001959610612d5f575b505050811b01601555565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88560031b161c199101351690555f8080612d54565b90926020600181928686013581550194019101612d41565b73ffffffffffffffffffffffffffffffffffffffff1690811561075157335f52600b60205260405f20825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3600190565b90612e3f825f52600e60205273ffffffffffffffffffffffffffffffffffffffff60405f20541690565b917f800000000000000000000000000000000000000000000000000000000000000081119081612ede575b5015612eb65773ffffffffffffffffffffffffffffffffffffffff821615612e8e57565b7fc5723b51000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f3f6cc768000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff915014155f612e6a565b90612f13826129b2565b612f20604051918261285a565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0612f4e82946129b2565b0190602036910137565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610b215760010190565b91908201809211610b2157565b8051821015612fa65760209160051b010190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b9291907f8000000000000000000000000000000000000000000000000000000000000000821180613199575b15612eb65761300f828286612b74565b50803b1515938461304d575b5050505061302557565b7f3da63931000000000000000000000000000000000000000000000000000000005f5260045ffd5b60209394505f73ffffffffffffffffffffffffffffffffffffffff80926130bc604051988997889687947f150b7a02000000000000000000000000000000000000000000000000000000008652336004870152166024850152604484015260806064840152608483019061289b565b0393165af1908115610746575f9161311e575b507fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a020000000000000000000000000000000000000000000000000000000014155f80808061301b565b90506020813d602011613191575b816131396020938361285a565b8101031261032157517fffffffff0000000000000000000000000000000000000000000000000000000081168103610321577fffffffff000000000000000000000000000000000000000000000000000000006130cf565b3d915061312c565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612fff565b91908203918211610b2157565b919073ffffffffffffffffffffffffffffffffffffffff83169283156132ac5773ffffffffffffffffffffffffffffffffffffffff821615610e505783612b10945f52600b60205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260405f2054847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361326e575b50505061390c565b613277916131c3565b905f52600b60205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260405f20555f8084613266565b7fddb5de5e000000000000000000000000000000000000000000000000000000005f5260045ffd5b919073ffffffffffffffffffffffffffffffffffffffff831680156132ac5773ffffffffffffffffffffffffffffffffffffffff821615610e505773ffffffffffffffffffffffffffffffffffffffff61334d845f52600e60205273ffffffffffffffffffffffffffffffffffffffff60405f20541690565b1681036133bd57803314159081613411575b50806133e5575b6133bd5761337381612b3d565b613395576133939261338e670de0b6b3a76400008383613b64565b613bf1565b565b7f5ce75397000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f82b42900000000000000000000000000000000000000000000000000000000005f5260045ffd5b50815f52600c60205273ffffffffffffffffffffffffffffffffffffffff60405f205416331415613366565b90505f52600d60205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260ff60405f205416155f61335f565b73ffffffffffffffffffffffffffffffffffffffff613487835f52600e60205273ffffffffffffffffffffffffffffffffffffffff60405f20541690565b168033141580613508575b6133bd57825f52600c60205273ffffffffffffffffffffffffffffffffffffffff60405f20921691827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f80a4565b50805f52600d60205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260ff60405f20541615613492565b73ffffffffffffffffffffffffffffffffffffffff1680156136005773ffffffffffffffffffffffffffffffffffffffff7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930054827fffffffffffffffffffffffff00000000000000000000000000000000000000008216177f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3565b7f1e4fbdf7000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b73ffffffffffffffffffffffffffffffffffffffff7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005416330361366c57565b7f118cdaa7000000000000000000000000000000000000000000000000000000005f523360045260245ffd5b8054821015612fa6575f5260205f2001905f90565b600a6020527f13da86008ba1c6922daee3e07db95305ef49ebced9f5467a0b8613fcc6b343e35473ffffffffffffffffffffffffffffffffffffffff82165f81815260408120549394929392906137079082908790613b64565b600161371286612b3d565b908080613905575b1561372c575b50505050505050600190565b1561379257505061376692505f52600a60205261376060405f205461375a670de0b6b3a76400008092612bf3565b92612bf3565b906131c3565b905f5b828110613780575050505b5f808080808080613720565b60019061378c8361417a565b01613769565b909190156137ed575050506137cb91506137606137b8670de0b6b3a76400008093612bf3565b915f8052600a60205260405f2054612bf3565b5f5b8181106137db575050613774565b6001906137e75f613f18565b016137cd565b613800670de0b6b3a76400008093612bf3565b80945f5b82811061387d5750918391613839613823613854979661376096612bf3565b5f8052600a6020526137608560405f2054612bf3565b1161386f575b5f52600a60205261375a8160405f2054612bf3565b11613860575b50613774565b6138699061417a565b5f61385a565b6138785f613f18565b61383f565b5f8052600f6020527ff4803e074bd026baaf6ed2e288c9515f68c72fb7216eebdd7cae1718a53ec375549192507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8201918211610b21576138fc6138ee6001935f8052600f60205260405f20613698565b90549060031b1c895f613bf1565b01908591613804565b508161371a565b9173ffffffffffffffffffffffffffffffffffffffff8316805f52600a60205260405f20549073ffffffffffffffffffffffffffffffffffffffff841691825f52600a60205260405f205493613963818789613b64565b61396c87612b3d565b61397587612b3d565b908080613b5d575b15613991575b505050505050505050600190565b156139f057505050506139c29293505f52600a60205261376060405f205461375a670de0b6b3a76400008092612bf3565b905f5b8281106139de575050505b5f8080808080808080613983565b6001906139ea8361417a565b016139c5565b959390919492955f14613a52575050505090613760613a2e92613a1c670de0b6b3a76400008092612bf3565b925f52600a60205260405f2054612bf3565b905f5b828110613a40575050506139d0565b600190613a4c83613f18565b01613a31565b91935f9691939650613a6d670de0b6b3a76400008095612bf3565b9586915f5b838110613aef575091613aa9869492613a93613ac599986137609896612bf3565b905f52600a6020526137608660405f2054612bf3565b11613ae0575b505f52600a60205261375a8160405f2054612bf3565b11613ad1575b506139d0565b613ada9061417a565b5f613acb565b613ae990613f18565b5f613aaf565b90918093505f52600f60205260405f2054907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8201918211610b2157613b53613b45600193865f52600f60205260405f20613698565b90549060031b1c8b87613bf1565b0190879291613a72565b508161397d565b602073ffffffffffffffffffffffffffffffffffffffff807fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef93169384155f14613bd457613bb486600654612f85565b6006555b1693845f52600a825260405f20818154019055604051908152a3565b845f52600a835260405f20613bea8782546131c3565b9055613bb8565b73ffffffffffffffffffffffffffffffffffffffff169081613d44575b73ffffffffffffffffffffffffffffffffffffffff16908115613d31575f838152600e6020908152604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000001686019055848352600f909152902080546801000000000000000081101561201257613c9481613cca9360018894018155613698565b9091907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83549160031b92831b921b1916179055565b815f52600f60205260405f20547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908111610b2157613d0b90846143e4565b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f80a4565b825f52600e6020525f6040812055613d0b565b5f838152600c6020908152604080832080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055848352600f909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908111610b2157613db991613698565b90549060031b1c838103613e88575b50815f52600f60205260405f20908154918215613e5b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff930190613e53613e258383613698565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82549160031b1b19169055565b559050613c0e565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603160045260245ffd5b613ebb90845f52600e60205260405f205460a01c90845f52600f602052613eb681613c948460405f20613698565b6143e4565b5f613dc8565b60ff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460401c1615613ef057565b7fd7e6bcf8000000000000000000000000000000000000000000000000000000005f5260045ffd5b73ffffffffffffffffffffffffffffffffffffffff1680156132ac575f818152600f6020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908111610b2157613f7691613698565b90549060031b1c90815f52600c60205260405f207fffffffffffffffffffffffff00000000000000000000000000000000000000008154169055805f52600f60205260405f20815f52600f60205260405f20547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908111610b2157613ffc91613698565b90549060031b1c828103614146575b50805f52600f60205260405f20908154908115613e5b5783927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5f930190614056613e258383613698565b55828252600e6020528160408120557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4600254906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81841601169160801c821461411e576140f2826fffffffffffffffffffffffffffffffff165f52600360205260405f2090565b557fffffffffffffffffffffffffffffffff000000000000000000000000000000006002541617600255565b7f8acb5f27000000000000000000000000000000000000000000000000000000005f5260045ffd5b61417490835f52600e60205260405f205460a01c90835f52600f602052613eb681613c948460405f20613698565b5f61400b565b73ffffffffffffffffffffffffffffffffffffffff811615610e5057600254608081901c6fffffffffffffffffffffffffffffffff90911614614337576002546fffffffffffffffffffffffffffffffff8160801c9116811461430f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff016fffffffffffffffffffffffffffffffff8116905f614257614235846fffffffffffffffffffffffffffffffff165f52600360205260405f2090565b54936fffffffffffffffffffffffffffffffff165f52600360205260405f2090565b556fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff000000000000000000000000000000006002549260801b169116176002555b6142c2815f52600e60205273ffffffffffffffffffffffffffffffffffffffff60405f20541690565b9173ffffffffffffffffffffffffffffffffffffffff83166142e75761339392613bf1565b7f23369fa6000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f75e52f4f000000000000000000000000000000000000000000000000000000005f5260045ffd5b614342600754612f58565b806007557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611170577f800000000000000000000000000000000000000000000000000000000000000001807f80000000000000000000000000000000000000000000000000000000000000001115614299577f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b90815f52600e60205260405f2054916bffffffffffffffffffffffff82116144535773ffffffffffffffffffffffffffffffffffffffff917fffffffffffffffffffffffff0000000000000000000000000000000000000000915f52600e60205260a01b1691160160405f2055565b7ffcb3438c000000000000000000000000000000000000000000000000000000005f5260045ffdfea264697066735822122028ade4d4e1e03ab8133a57b62ea1f6c4ea5d541a7044b4a3e2aaed590334736f64736f6c634300081c0033f0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00

Deployed Bytecode

0x6080806040526004361015610012575f80fd5b5f3560e01c90816301ffc9a7146126415750806302519da31461162e5780630608bdf8146125a757806306fdde03146124e4578063081812fc14612486578063095ea7b31461244157806309674eb0146123e657806309f0ef65146123a557806312d27371146119f257806318160ddd1461147557806323b872dd146119d95780632a55205a1461198c578063313ce567146119535780633644e515146119185780633e8a8009146118a157806342842e0e146118785780634d966072146118335780634f02c42014610c1257806355f804b3146117d35780635fda96e8146117435780636352211e146116e95780636e8f624b1461169157806370a082311461162e578063715018a61461155457806377fe143f146115135780637ecebe00146114b057806389fb4c66146114755780638a696e50146113365780638da5cb5b146112c657806395d89b41146111c05780639727756a14610fa3578063a22cb46514610ea0578063a9059cbb14610ddf578063b1ab931714610d2e578063b3f9ea3414610ccb578063b88d4fde14610c4d578063c5ab3ba614610c12578063c87b56dd146107f3578063d505accf14610508578063d96ca0b9146104e5578063dd62ed3e14610459578063dd63769914610442578063dfabc033146103ff578063e985e9c51461036e578063f2fde38b146103255763f780bc1a14610216575f80fd5b34610321576102243661297e565b61022d81612f09565b91806102526fffffffffffffffffffffffffffffffff6002548181169060801c031690565b6fffffffffffffffffffffffffffffffff60025416915b6102738585612f85565b81101561030757818110156102df576001816102c26fffffffffffffffffffffffffffffffff8061027395168701166fffffffffffffffffffffffffffffffff165f52600360205260405f2090565b546102d66102d088846131c3565b8a612f92565b52019050610269565b7f580821e7000000000000000000000000000000000000000000000000000000005f5260045ffd5b6040516020808252819061031d90820189612a27565b0390f35b5f80fd5b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215761036c61035f6127c3565b61036761362c565b61353f565b005b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576103a56127c3565b73ffffffffffffffffffffffffffffffffffffffff6103c26127e6565b91165f52600d60205273ffffffffffffffffffffffffffffffffffffffff60405f2091165f52602052602060ff60405f2054166040519015158152f35b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215761036c6104396127c3565b60243590613449565b346103215761036c6104533661290c565b916132d4565b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576104906127c3565b73ffffffffffffffffffffffffffffffffffffffff6104ad6127e6565b91165f52600b60205273ffffffffffffffffffffffffffffffffffffffff60405f2091165f52602052602060405f2054604051908152f35b346103215760206104fe6104f83661290c565b916131d0565b6040519015158152f35b346103215760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215761053f6127c3565b6105476127e6565b90604435606435916084359360ff8516809503610321574284106107cb577f80000000000000000000000000000000000000000000000000000000000000008311806107a1575b6107795773ffffffffffffffffffffffffffffffffffffffff169384156107515760805f9160209373ffffffffffffffffffffffffffffffffffffffff60095491169687855260118652604085209081549160018301905560405190878201927f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c984528a60408401528b6060840152898784015260a083015260c082015260c0815261063b60e08261285a565b51902060405190868201927f19010000000000000000000000000000000000000000000000000000000000008452602283015260428201526042815261068260628261285a565b519020906040519182528482015260a435604082015260c435606082015282805260015afa156107465773ffffffffffffffffffffffffffffffffffffffff5f51168015801561073c575b610714577f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925916020915f52600b825260405f20855f5282528060405f2055604051908152a3005b7f815e1d64000000000000000000000000000000000000000000000000000000005f5260045ffd5b50828114156106cd565b6040513d5f823e3d90fd5b7f5461585f000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f1f3e0de8000000000000000000000000000000000000000000000000000000005f5260045ffd5b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83141561058e565b7f05787bdf000000000000000000000000000000000000000000000000000000005f5260045ffd5b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760043573ffffffffffffffffffffffffffffffffffffffff61084382612e15565b1615610be75760405160155490915f8361085c84612809565b9182825260208201946001811690815f14610bad5750600114610b4e575b6108869250038461285a565b7f80000000000000000000000000000000000000000000000000000000000000008101908111610b21575f81807a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000811015610af6575b50806d04ee2d6d415b85acef8100000000600a921015610adb575b662386f26fc10000811015610ac7575b6305f5e100811015610ab6575b612710811015610aa7575b6064811015610a99575b1015610a91575b6001810191600a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602161097761096187612a5a565b9661096f604051988961285a565b808852612a5a565b947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe06020880196013687378601015b01917f30313233343536373839616263646566000000000000000000000000000000008282061a835304908115610a0157600a907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff906109a6565b61031d85610a7d6005896020888a6040519687945180918587015e840190838201905f8252519283915e01017f2e6a736f6e0000000000000000000000000000000000000000000000000000008152037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe581018452018261285a565b60405191829160208352602083019061289b565b60010161092b565b606460029104920191610924565b6127106004910492019161091a565b6305f5e1006008910492019161090f565b662386f26fc1000060109104920191610902565b6d04ee2d6d415b85acef8100000000602091049201916108f2565b604092507a184f03e93ff9f4daa797ed6e38ed64bf6a1f01000000000000000090049050600a6108d7565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5060155f90815290917f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec4755b818310610b915750509060206108869282010161087a565b6020919350806001915483858a01015201910190918592610b79565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686525061088692151560051b8201602001905061087a565b7fc5f05383000000000000000000000000000000000000000000000000000000005f5260045260245ffd5b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576020600754604051908152f35b346103215760807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157610c846127c3565b610c8c6127e6565b6064359167ffffffffffffffff8311610321573660238401121561032157610cc161036c933690602481600401359101612a94565b9160443591612fd3565b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215773ffffffffffffffffffffffffffffffffffffffff610d176127c3565b165f52600f602052602060405f2054604051908152f35b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215773ffffffffffffffffffffffffffffffffffffffff610d7a6127c3565b165f52600f60205260405f206040519081602082549182815201915f5260205f20905f5b818110610dc95761031d85610db58187038261285a565b604051918291602083526020830190612a27565b8254845260209093019260019283019201610d9e565b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157610e166127c3565b60ff60125460b01c1615610e785773ffffffffffffffffffffffffffffffffffffffff811615610e50576104fe602091602435903361390c565b7f9c8d2cd2000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fd12753b7000000000000000000000000000000000000000000000000000000005f5260045ffd5b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157610ed76127c3565b60243590811515908183036103215773ffffffffffffffffffffffffffffffffffffffff16918215610f7b57610f4d90335f52600d60205260405f20845f5260205260405f209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b6040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b7fccea9e6f000000000000000000000000000000000000000000000000000000005f5260045ffd5b346103215760607ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157610fda6127c3565b60243567ffffffffffffffff811161032157610ffa9036906004016129ca565b60443567ffffffffffffffff81116103215761101a9036906004016129ca565b5073ffffffffffffffffffffffffffffffffffffffff6013541633036111985761104e8151670de0b6b3a764000090612be0565b916110598251612f09565b926110648351612f09565b91600754915f925b85518410156110eb5761107e90612f58565b92837f80000000000000000000000000000000000000000000000000000000000000000190817f800000000000000000000000000000000000000000000000000000000000000011610b21576001916110d7828a612f92565b52816110e38288612f92565b52019261106c565b5085908473ffffffffffffffffffffffffffffffffffffffff841615610e50577f800000000000000000000000000000000000000000000000000000000000000061113883600654612f85565b116111705761114d61031d92611162956136ad565b50604051938493604085526040850190612a27565b908382036020850152612a27565b7f303b682f000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fed6fcad9000000000000000000000000000000000000000000000000000000005f5260045ffd5b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576040515f6005546111fe81612809565b80845290600181169081156112845750600114611226575b61031d83610a7d8185038261285a565b60055f9081527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0939250905b80821061126a57509091508101602001610a7d611216565b919260018160209254838588010152019101909291611252565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660208086019190915291151560051b84019091019150610a7d9050611216565b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157602073ffffffffffffffffffffffffffffffffffffffff7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005416604051908152f35b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157600435801515810361032157331561144d5780156113e857335f52600f60205260405f20545f5b8181106113d657505061036c905b335f52601060205260405f209060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b6001906113e233613f18565b0161138c565b335f52600a60205261140760405f2054670de0b6b3a764000090612bf3565b90335f52600f60205260405f20545f5b61142182856131c3565b81101561144157906001611421926114383361417a565b01909150611417565b505061036c915061139a565b7fa41e3d3f000000000000000000000000000000000000000000000000000000005f5260045ffd5b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576020600654604051908152f35b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215773ffffffffffffffffffffffffffffffffffffffff6114fc6127c3565b165f526011602052602060405f2054604051908152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576020670de0b6b3a7640000604051908152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215761158a61362c565b5f73ffffffffffffffffffffffffffffffffffffffff7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300547fffffffffffffffffffffffff000000000000000000000000000000000000000081167f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215773ffffffffffffffffffffffffffffffffffffffff61167a6127c3565b165f52600a602052602060405f2054604051908152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760206040517f80000000000000000000000000000000000000000000000000000000000000008152f35b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576020611725600435612e15565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215773ffffffffffffffffffffffffffffffffffffffff60135416330361119857601280547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16760100000000000000000000000000000000000000000000179055005b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760043567ffffffffffffffff81116103215761182561036c9136906004016128de565b9061182e61362c565b612c7a565b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760206104fe61186f6127c3565b60243590612daf565b346103215761036c6118893661290c565b906040519261189960208561285a565b5f8452612fd3565b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760043567ffffffffffffffff8111610321576118f09036906004016128de565b73ffffffffffffffffffffffffffffffffffffffff6013541633036111985761036c91612c7a565b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576020600954604051908152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157602060405160128152f35b3461032157604061199c3661297e565b90506127106119b36012549261ffff841690612be0565b0473ffffffffffffffffffffffffffffffffffffffff83519260101c1682526020820152f35b346103215760206104fe6119ec3661290c565b91612b74565b34610321576101007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157611a2a6127c3565b611a326127e6565b60443567ffffffffffffffff811161032157611a529036906004016128de565b91909260643567ffffffffffffffff811161032157611a759036906004016128de565b93909160843567ffffffffffffffff811161032157611a989036906004016128de565b5f9591955060a4359461ffff86168096036103215760c4359673ffffffffffffffffffffffffffffffffffffffff881688036103215760e43573ffffffffffffffffffffffffffffffffffffffff81168103610321577ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00549260ff8460401c16159a67ffffffffffffffff85168015908161239d575b6001149081612393575b15908161238a575b5061236257611bb7611bbe93868e60017fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000611bc69a16177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005561230d575b50611ba7613ec1565b611baf613ec1565b610367613ec1565b3691612a94565b923691612a94565b90611bcf613ec1565b611bd7613ec1565b80519067ffffffffffffffff821161201257611bf4600454612809565b601f81116122aa575b50602090601f83116001146121ea57611c4b92915f91836121df575b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b6004555b80519067ffffffffffffffff821161201257611c6c600554612809565b601f8111612199575b50602090601f83116001146120d957611cc292915f91836120ce5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b6005555b46600855604051600454905f611cdb83612809565b808352602083019360018116908115612097575060011461203f575b509181611d1e73ffffffffffffffffffffffffffffffffffffffff9695938795038261285a565b51902060405160208101917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f835260408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a08152611d9260c08261285a565b519020600955611da0613ec1565b167fffffffffffffffffffffffff00000000000000000000000000000000000000006013541617601355167fffffffffffffffffffffffff0000000000000000000000000000000000000000601454161760145567ffffffffffffffff811161201257611e1781611e12601554612809565b612c2a565b5f601f8211600114611f53578190611e64939495965f92611f485750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b6015555b7fffffffffffffffffffff0000000000000000000000000000000000000000000075ffffffffffffffffffffffffffffffffffffffff00006012549360101b1692161717601255611eb557005b7fffffffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054167ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00557fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602060405160018152a1005b013590508680611c19565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082169560155f527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475915f5b888110611ffa57508360019596979810611fc2575b505050811b01601555611e68565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88560031b161c19910135169055858080611fb4565b90926020600181928686013581550194019101611f9f565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60045f90815291507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b81831061207d575050810160200181611cf7565b600181602092949394548385880101520191019190612069565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016855250151560051b8201602001905081611cf7565b015190508a80611c19565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe083169160055f527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0925f5b818110612181575090846001959493921061214a575b505050811b01600555611cc6565b01517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c1916905589808061213c565b92936020600181928786015181550195019301612126565b60055f5260205f20601f840160051c810191602085106121d5575b601f0160051c01905b8181106121ca5750611c75565b5f81556001016121bd565b90915081906121b4565b015190508b80611c19565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe083169160045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b925f5b818110612292575090846001959493921061225b575b505050811b01600455611c4f565b01517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88460031b161c191690558a808061224d565b92936020600181928786015181550195019301612237565b60045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f840160051c81019160208510612303575b601f0160051c01905b8181106122f85750611bfd565b5f81556001016122eb565b90915081906122e2565b7fffffffffffffffffffffffffffffffffffffffffffffff0000000000000000001668010000000000000001177ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00558f611b9e565b7ff92ee8a9000000000000000000000000000000000000000000000000000000005f5260045ffd5b9050158e611b40565b303b159150611b38565b8d9150611b2e565b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760206104fe6123e16127c3565b612b3d565b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760206124396fffffffffffffffffffffffffffffffff6002548181169060801c031690565b604051908152f35b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760206104fe61247d6127c3565b60243590612aca565b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576004355f52600c602052602073ffffffffffffffffffffffffffffffffffffffff60405f205416604051908152f35b34610321575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610321576040515f60045461252281612809565b808452906001811690811561128457506001146125495761031d83610a7d8185038261285a565b60045f9081527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b939250905b80821061258d57509091508101602001610a7d611216565b919260018160209254838588010152019101909291612575565b346103215760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126103215760043561ffff8116809103610321576125ed6127e6565b906125f661362c565b7fffffffffffffffffffff0000000000000000000000000000000000000000000075ffffffffffffffffffffffffffffffffffffffff00006012549360101b16921617176012555f80f35b346103215760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261032157600435907fffffffff00000000000000000000000000000000000000000000000000000000821680920361032157817ff677638b0000000000000000000000000000000000000000000000000000000060209314908115612799575b811561276f575b8115612745575b81156126e8575b5015158152f35b7fcaf91ff50000000000000000000000000000000000000000000000000000000081149150811561271b575b50836126e1565b7f01ffc9a70000000000000000000000000000000000000000000000000000000091501483612714565b7f2a55205a00000000000000000000000000000000000000000000000000000000811491506126da565b7f5b5e139f00000000000000000000000000000000000000000000000000000000811491506126d3565b7f80ac58cd00000000000000000000000000000000000000000000000000000000811491506126cc565b6004359073ffffffffffffffffffffffffffffffffffffffff8216820361032157565b6024359073ffffffffffffffffffffffffffffffffffffffff8216820361032157565b90600182811c92168015612850575b602083101461282357565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b91607f1691612818565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761201257604052565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602080948051918291828752018686015e5f8582860101520116010190565b9181601f840112156103215782359167ffffffffffffffff8311610321576020838186019501011161032157565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc60609101126103215760043573ffffffffffffffffffffffffffffffffffffffff81168103610321579060243573ffffffffffffffffffffffffffffffffffffffff81168103610321579060443590565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc6040910112610321576004359060243590565b67ffffffffffffffff81116120125760051b60200190565b9080601f830112156103215781356129e1816129b2565b926129ef604051948561285a565b81845260208085019260051b82010192831161032157602001905b828210612a175750505090565b8135815260209182019101612a0a565b90602080835192838152019201905f5b818110612a445750505090565b8251845260209384019390920191600101612a37565b67ffffffffffffffff811161201257601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b929192612aa082612a5a565b91612aae604051938461285a565b829481845281830111610321578281602093845f960137010152565b907f8000000000000000000000000000000000000000000000000000000000000000811180612b13575b15612b0757612b0291613449565b600190565b612b1091612daf565b90565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811415612af4565b73ffffffffffffffffffffffffffffffffffffffff168015908115612b60575090565b90505f52601060205260ff60405f20541690565b91907f8000000000000000000000000000000000000000000000000000000000000000821180612bb6575b15612bad57612b02926132d4565b612b10926131d0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612b9f565b81810292918115918404141715610b2157565b8115612bfd570490565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b601f8111612c36575050565b60155f5260205f20906020601f840160051c83019310612c70575b601f0160051c01905b818110612c65575050565b5f8155600101612c5a565b9091508190612c51565b919067ffffffffffffffff811161201257612c9a81611e12601554612809565b5f601f8211600114612cf5578190612ce593945f92612cea5750507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260011b9260031b1c19161790565b601555565b013590505f80611c19565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082169360155f527f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475915f5b868110612d975750836001959610612d5f575b505050811b01601555565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88560031b161c199101351690555f8080612d54565b90926020600181928686013581550194019101612d41565b73ffffffffffffffffffffffffffffffffffffffff1690811561075157335f52600b60205260405f20825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3600190565b90612e3f825f52600e60205273ffffffffffffffffffffffffffffffffffffffff60405f20541690565b917f800000000000000000000000000000000000000000000000000000000000000081119081612ede575b5015612eb65773ffffffffffffffffffffffffffffffffffffffff821615612e8e57565b7fc5723b51000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f3f6cc768000000000000000000000000000000000000000000000000000000005f5260045ffd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff915014155f612e6a565b90612f13826129b2565b612f20604051918261285a565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0612f4e82946129b2565b0190602036910137565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610b215760010190565b91908201809211610b2157565b8051821015612fa65760209160051b010190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b9291907f8000000000000000000000000000000000000000000000000000000000000000821180613199575b15612eb65761300f828286612b74565b50803b1515938461304d575b5050505061302557565b7f3da63931000000000000000000000000000000000000000000000000000000005f5260045ffd5b60209394505f73ffffffffffffffffffffffffffffffffffffffff80926130bc604051988997889687947f150b7a02000000000000000000000000000000000000000000000000000000008652336004870152166024850152604484015260806064840152608483019061289b565b0393165af1908115610746575f9161311e575b507fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a020000000000000000000000000000000000000000000000000000000014155f80808061301b565b90506020813d602011613191575b816131396020938361285a565b8101031261032157517fffffffff0000000000000000000000000000000000000000000000000000000081168103610321577fffffffff000000000000000000000000000000000000000000000000000000006130cf565b3d915061312c565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612fff565b91908203918211610b2157565b919073ffffffffffffffffffffffffffffffffffffffff83169283156132ac5773ffffffffffffffffffffffffffffffffffffffff821615610e505783612b10945f52600b60205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260405f2054847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361326e575b50505061390c565b613277916131c3565b905f52600b60205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260405f20555f8084613266565b7fddb5de5e000000000000000000000000000000000000000000000000000000005f5260045ffd5b919073ffffffffffffffffffffffffffffffffffffffff831680156132ac5773ffffffffffffffffffffffffffffffffffffffff821615610e505773ffffffffffffffffffffffffffffffffffffffff61334d845f52600e60205273ffffffffffffffffffffffffffffffffffffffff60405f20541690565b1681036133bd57803314159081613411575b50806133e5575b6133bd5761337381612b3d565b613395576133939261338e670de0b6b3a76400008383613b64565b613bf1565b565b7f5ce75397000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f82b42900000000000000000000000000000000000000000000000000000000005f5260045ffd5b50815f52600c60205273ffffffffffffffffffffffffffffffffffffffff60405f205416331415613366565b90505f52600d60205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260ff60405f205416155f61335f565b73ffffffffffffffffffffffffffffffffffffffff613487835f52600e60205273ffffffffffffffffffffffffffffffffffffffff60405f20541690565b168033141580613508575b6133bd57825f52600c60205273ffffffffffffffffffffffffffffffffffffffff60405f20921691827fffffffffffffffffffffffff00000000000000000000000000000000000000008254161790557f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f80a4565b50805f52600d60205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260ff60405f20541615613492565b73ffffffffffffffffffffffffffffffffffffffff1680156136005773ffffffffffffffffffffffffffffffffffffffff7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930054827fffffffffffffffffffffffff00000000000000000000000000000000000000008216177f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3565b7f1e4fbdf7000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b73ffffffffffffffffffffffffffffffffffffffff7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c1993005416330361366c57565b7f118cdaa7000000000000000000000000000000000000000000000000000000005f523360045260245ffd5b8054821015612fa6575f5260205f2001905f90565b600a6020527f13da86008ba1c6922daee3e07db95305ef49ebced9f5467a0b8613fcc6b343e35473ffffffffffffffffffffffffffffffffffffffff82165f81815260408120549394929392906137079082908790613b64565b600161371286612b3d565b908080613905575b1561372c575b50505050505050600190565b1561379257505061376692505f52600a60205261376060405f205461375a670de0b6b3a76400008092612bf3565b92612bf3565b906131c3565b905f5b828110613780575050505b5f808080808080613720565b60019061378c8361417a565b01613769565b909190156137ed575050506137cb91506137606137b8670de0b6b3a76400008093612bf3565b915f8052600a60205260405f2054612bf3565b5f5b8181106137db575050613774565b6001906137e75f613f18565b016137cd565b613800670de0b6b3a76400008093612bf3565b80945f5b82811061387d5750918391613839613823613854979661376096612bf3565b5f8052600a6020526137608560405f2054612bf3565b1161386f575b5f52600a60205261375a8160405f2054612bf3565b11613860575b50613774565b6138699061417a565b5f61385a565b6138785f613f18565b61383f565b5f8052600f6020527ff4803e074bd026baaf6ed2e288c9515f68c72fb7216eebdd7cae1718a53ec375549192507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8201918211610b21576138fc6138ee6001935f8052600f60205260405f20613698565b90549060031b1c895f613bf1565b01908591613804565b508161371a565b9173ffffffffffffffffffffffffffffffffffffffff8316805f52600a60205260405f20549073ffffffffffffffffffffffffffffffffffffffff841691825f52600a60205260405f205493613963818789613b64565b61396c87612b3d565b61397587612b3d565b908080613b5d575b15613991575b505050505050505050600190565b156139f057505050506139c29293505f52600a60205261376060405f205461375a670de0b6b3a76400008092612bf3565b905f5b8281106139de575050505b5f8080808080808080613983565b6001906139ea8361417a565b016139c5565b959390919492955f14613a52575050505090613760613a2e92613a1c670de0b6b3a76400008092612bf3565b925f52600a60205260405f2054612bf3565b905f5b828110613a40575050506139d0565b600190613a4c83613f18565b01613a31565b91935f9691939650613a6d670de0b6b3a76400008095612bf3565b9586915f5b838110613aef575091613aa9869492613a93613ac599986137609896612bf3565b905f52600a6020526137608660405f2054612bf3565b11613ae0575b505f52600a60205261375a8160405f2054612bf3565b11613ad1575b506139d0565b613ada9061417a565b5f613acb565b613ae990613f18565b5f613aaf565b90918093505f52600f60205260405f2054907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8201918211610b2157613b53613b45600193865f52600f60205260405f20613698565b90549060031b1c8b87613bf1565b0190879291613a72565b508161397d565b602073ffffffffffffffffffffffffffffffffffffffff807fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef93169384155f14613bd457613bb486600654612f85565b6006555b1693845f52600a825260405f20818154019055604051908152a3565b845f52600a835260405f20613bea8782546131c3565b9055613bb8565b73ffffffffffffffffffffffffffffffffffffffff169081613d44575b73ffffffffffffffffffffffffffffffffffffffff16908115613d31575f838152600e6020908152604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000001686019055848352600f909152902080546801000000000000000081101561201257613c9481613cca9360018894018155613698565b9091907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83549160031b92831b921b1916179055565b815f52600f60205260405f20547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908111610b2157613d0b90846143e4565b7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f80a4565b825f52600e6020525f6040812055613d0b565b5f838152600c6020908152604080832080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055848352600f909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908111610b2157613db991613698565b90549060031b1c838103613e88575b50815f52600f60205260405f20908154918215613e5b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff930190613e53613e258383613698565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82549160031b1b19169055565b559050613c0e565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603160045260245ffd5b613ebb90845f52600e60205260405f205460a01c90845f52600f602052613eb681613c948460405f20613698565b6143e4565b5f613dc8565b60ff7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a005460401c1615613ef057565b7fd7e6bcf8000000000000000000000000000000000000000000000000000000005f5260045ffd5b73ffffffffffffffffffffffffffffffffffffffff1680156132ac575f818152600f6020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908111610b2157613f7691613698565b90549060031b1c90815f52600c60205260405f207fffffffffffffffffffffffff00000000000000000000000000000000000000008154169055805f52600f60205260405f20815f52600f60205260405f20547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908111610b2157613ffc91613698565b90549060031b1c828103614146575b50805f52600f60205260405f20908154908115613e5b5783927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5f930190614056613e258383613698565b55828252600e6020528160408120557fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4600254906fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81841601169160801c821461411e576140f2826fffffffffffffffffffffffffffffffff165f52600360205260405f2090565b557fffffffffffffffffffffffffffffffff000000000000000000000000000000006002541617600255565b7f8acb5f27000000000000000000000000000000000000000000000000000000005f5260045ffd5b61417490835f52600e60205260405f205460a01c90835f52600f602052613eb681613c948460405f20613698565b5f61400b565b73ffffffffffffffffffffffffffffffffffffffff811615610e5057600254608081901c6fffffffffffffffffffffffffffffffff90911614614337576002546fffffffffffffffffffffffffffffffff8160801c9116811461430f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff016fffffffffffffffffffffffffffffffff8116905f614257614235846fffffffffffffffffffffffffffffffff165f52600360205260405f2090565b54936fffffffffffffffffffffffffffffffff165f52600360205260405f2090565b556fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffff000000000000000000000000000000006002549260801b169116176002555b6142c2815f52600e60205273ffffffffffffffffffffffffffffffffffffffff60405f20541690565b9173ffffffffffffffffffffffffffffffffffffffff83166142e75761339392613bf1565b7f23369fa6000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f75e52f4f000000000000000000000000000000000000000000000000000000005f5260045ffd5b614342600754612f58565b806007557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611170577f800000000000000000000000000000000000000000000000000000000000000001807f80000000000000000000000000000000000000000000000000000000000000001115614299577f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b90815f52600e60205260405f2054916bffffffffffffffffffffffff82116144535773ffffffffffffffffffffffffffffffffffffffff917fffffffffffffffffffffffff0000000000000000000000000000000000000000915f52600e60205260a01b1691160160405f2055565b7ffcb3438c000000000000000000000000000000000000000000000000000000005f5260045ffdfea264697066735822122028ade4d4e1e03ab8133a57b62ea1f6c4ea5d541a7044b4a3e2aaed590334736f64736f6c634300081c0033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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