ETH Price: $3,299.47 (-1.65%)

Token

Pixie Realm (PIXIE)
 

Overview

Max Total Supply

10,000 PIXIE

Holders

220

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Balance
0 PIXIE

Value
$0.00
0x0b8a49d816cc709b6eadb09498030ae3416b66dc
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
PixieRealm404

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 19 : PixieRealm404.sol
//                                                   ▄
//                                                 ▄█
//                                                ██
//                                               █ █▄▄▄▄▄▄▄
//                                            ▄▄▀█ ██      ▀▀▀▄▄
//                                          ▄█      ▀▀         ▀█▄
//                                         █▀                    ▀█▄
//                                        ▄▀                      ▀██▄
//                                        █      ▄█ █▄              ▀█▄
//                                       ██    ▄█▀▀▄█▀█▄             ▀██
//                                       ██   █▀   ██  ▀▀█▄           ███▄
//                                     ▄███  █▄▀▀   █  ▄▄▄██▄   ▄     █████▄
//                                 ▄▄███▄█▀  █▄██▄         ▀█   █     ██▀▀▀▀▀
//               ▄▀▀▀▀▀▀▀▄▄▄▄            █  ▀▀█ █▄    ▄  ▄▄▄█   █     ██           ▄▄▄▄▄▄▄▄▄▄▄▄
//               █           ▀▀▀▄▄      ▄▀ █  █  ▀     ▀▀▀▀▀██ ██▀▀▀▀███      ▄▄▀▀▀          ▄█
//                █               ▀▀▄  ▄▀ ▄█ █▀▄           ▄██ ██▄▄▀▀██   ▄▄▀▀               █
//                ▀▄                 ▀▄█▀▀▀█▄▀ ▀▄  ▄▄    ▄██▀█▄█▀ █▄██  ▄▀                  █▀
//                 ▀▄                  ▀█▄ █▀    ▀▄▄▀  ▄██▀ ▄▀█▀  ███ ▄▀                  ▄█▀
//                  ▀▄                   █ ▀        █▀▀ ██  ██▀   ██ ▄▀                  ▄█
//                ▄▀▄▀▄                   ▀▄     ▄▄▄▀   ▀█▄▄▀▀    ▀ ▄▀            ▄█   ▄█▀
//              ▄▀   ▀▄▀▄                   ▀█▀▀▀          ▀▀▀█▄   ▄▀           ▄▀ █ ▄█▀
//            ▄▀       ▀▄█▄                 █ ▄▀          ▄    ██  ▀           █   ██▀
//          ▄▀           ▀▄▀▄       ▄▄▄▄    ██▀           ▀▄   ██              █   █
//        ▄▀       ▄█▄     ▀▄     ▄█▀  ▀█▄▄█▀       █      ▀█  ██▄▄▀▀▀▀▄       █   █   ▄▄▄▄▄▄
//      ▄▀       ▄█████▄     ▀▄  █▀     ▄█▀█   ▄   █    ▄   ██ ██▄     ██ ▄▄   █   █ ▄▀   ▄▀ ▀▄
//    ▄▀       ▄█▀▀████▀    ▄█▀█▀█▄   ▄█▀█ █ ▄▀ ▀▄ █  ▄▀ ▀▄▄██ █▀█▄   ▄██▀  ▀▄ █   █▀   ▄▀   ▄▀█
//    █▄     ▄█▀    ▀▀    ▄█▀  █  ▀███▀█  ▀▄▀  ▄  ▀▄█▀     ▀█▄▀  ▄▀▀▀██▀▀ ▄▄  ▀█   █   █   ▄▀  █
//     ▀█▄ ▄██          ▄█▀█   █   █   █   █  ███   █       ▄█  ███   █ ▄▀▄██  █   █   █   █   █
//       ▀█▀ █    ██▄ ▄█▀  ██▄ █   ▀   █  ▄█   ▀  ▄▀█   █▄▄█▀█   ▀  ▄▀█▀▄▀  ▀  █   █   █   █   █
//           █    █ ▀█▀    █ ▀██▄     ▄█▄▀ █  ▄ ▄▀▄▀█   █▄▀▄▀█  ▄ ▄▀▄▀█▀  ▄▄   █ ▄██▄  █  ▄█▄  █
//           █    █        █   █       █   █  █▀▄▀  █   █ ▀ ▀█  █▀▄▀  █  ███▀  ██▀  ▀█▄█▄█▀ ▀█▄█
//           █    █        █▄  █   █   █  ▄█▄  ▀   ▄█▄  █ ▀ ▀█▄  ▀   ▄█▄  ▀  ▄█▀      ▀█▀     ▀█
//          █▀   ▄█         ▀█▄█   █   █▄█▀ ▀█▄  ▄█▀ ▀█▄█ ▀ ▀ ▀█▄  ▄█▀ ▀█▄ ▄█▀
//          ▀█▄▄█▀            ▀█▄  █  ▄█▀     ▀██▀     ▀▀       ▀██▀     ▀█▀
//            ▀▀                ▀█▄█▄█▀
//                                ▀█▀

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import {
    ERC404,
    ERC404Viewable
} from "./extensions/index.sol";

import { IMinter } from "./periphery/IMinter.sol";
import { Ownable } from "openzeppelin-contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

contract PixieRealm404 is Ownable, ERC404Viewable {

    constructor(
        string memory name_,
        string memory symbol_,
        IMinter minter_,
        address initialOwner_
    )
        Ownable(initialOwner_)
        ERC404(name_, symbol_, minter_.decimals())
    {

        _setBaseURI("https://pixierealm.io/api/pixie404?mode=meta&tid=");

        // initial unminted token supply split
        uint256 ERC20TotalSupply = minter_.supply() * minter_.units();
        uint256 ERC20MinterSupply = ERC20TotalSupply * 12 / 100;

        // skip 721 transfer to minter contract
        // initially mints when a caller transacts with minter
        _setERC721TransferExempt(address(minter_), true);
        _mintERC20(address(minter_), ERC20MinterSupply);

        // skip 721 transfer on mint to owner
        // owner can set up pool, whitelist it, and lp remaining supply to mint
        _setERC721TransferExempt(initialOwner_, true);
        _mintERC20(initialOwner_, ERC20TotalSupply - ERC20MinterSupply);
    }

    /// @notice external entry for owner to set ERC721 transfer whitelist
    /// @dev should be used during liqudiity setup to atomically:
    /// 1) create pool
    /// 2) call this function with [poolAddress, true]
    /// 3) LP in pool
    /// 3) set this address as the token in Minter.sol
    /// 4) unpause minter contract
    function setERC721TransferExempt(address who, bool whitelist) external onlyOwner {
        _setERC721TransferExempt(who, whitelist);
    }

    function tokenURI(uint256 id_) public view override returns (string memory) {
        string memory baseURI = __baseURI;
        return string.concat(baseURI, Strings.toString(id_));
    }

    string private __baseURI;

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

    function setBaseURI(string memory baseURI) public onlyOwner {
        _setBaseURI(baseURI);
    }

    function _setBaseURI(string memory baseURI_) internal {
        __baseURI = baseURI_;
    }
}

File 2 of 19 : index.sol
pragma solidity ^0.8.0;

import { ERC404Viewable } from "./ERC404Viewable.sol";
import { ERC404 } from "../ERC404.sol";

File 3 of 19 : IMinter.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IMinter {
    function decimals() external view returns (uint8);
    function supply() external view returns (uint256);
    function units() external view returns (uint256);

    function setToken(address token_) external;
    function mint(uint256 amount) external payable;
}

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

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.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 Ownable is Context {
    address private _owner;

    /**
     * @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.
     */
    constructor(address initialOwner) {
        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) {
        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 {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 5 of 19 : 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 6 of 19 : ERC404Viewable.sol
pragma solidity ^0.8.0;

import "../ERC404.sol";

abstract contract ERC404Viewable is ERC404 {
    using DoubleEndedQueue for DoubleEndedQueue.Uint256Deque;
    using LinkedListInventory for LinkedListStorage;

    function dequeueFront() external view returns (uint256) {
        return _storedERC721Ids.front();
    }

    function dequeueBack() external view returns (uint256) {
        return _storedERC721Ids.back();
    }

    function dequeueAt(uint256 index) external view returns (uint256) {
        return _storedERC721Ids.at(index);
    }

    function dequeueLength() external view returns (uint256) {
        return _storedERC721Ids.length();
    }

    function dequeueEmpty() external view returns (bool) {
        return _storedERC721Ids.empty();
    }

    function getOwnedLinkedList(address account) external view returns(
		Reference[] memory list,
		uint16 head,
		uint16[] memory tokens
	) {
		return _owned.getLinkedList(account);
	}
}

File 7 of 19 : ERC404.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

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 "erc404/lib/DoubleEndedQueue.sol";
import {ERC721Events} from "erc404/lib/ERC721Events.sol";
import {ERC20Events} from "erc404/lib/ERC20Events.sol";
import "./types/LinkedListInventory.sol";

abstract contract ERC404 is IERC404 {
  using DoubleEndedQueue for DoubleEndedQueue.Uint256Deque;
  using LinkedListInventory for LinkedListStorage;

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

  /// @dev Token name
  string public name;

  /// @dev Token symbol
  string public symbol;

  /// @dev Decimals for ERC-20 representation
  uint8 public immutable decimals;

  /// @dev Units for ERC-20 representation
  uint256 public immutable units;

  /// @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 immutable _INITIAL_CHAIN_ID;

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

  /// @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 LinkedList of owned ids in ERC-721 representation
  LinkedListStorage 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;

  constructor(string memory name_, string memory symbol_, uint8 decimals_) {
    name = name_;
    symbol = symbol_;

    if (decimals_ < 18) {
      revert DecimalsTooLow();
    }

    decimals = decimals_;
    units = 10 ** decimals;

    // EIP-2612 initialization
    _INITIAL_CHAIN_ID = block.chainid;
    _INITIAL_DOMAIN_SEPARATOR = _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 (uint16[] memory) {
    return _owned.tidsOrdered(owner_);
  }

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

  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 reordering the indices of the owned linkedList
  /// for transferOut ordering
  function reorderOwned(uint16[] calldata newList, uint16 newHead) public {
    _owned.commitLinkedList(newList, newHead);
  }

  /// @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
      block.chainid == _INITIAL_CHAIN_ID
        ? _INITIAL_DOMAIN_SEPARATOR
        : _computeDomainSeparator();
  }

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

      _owned.inventoryTransferOut(from_, uint16(id_));
    }

    // 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.inventoryTransferIn(to_, uint16(id_));
    } 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 tokenId = uint256(_owned.getHead(from_));
        _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();
    }

    // Transfer the token to the contract.
    uint16 id = _owned.pop(from_);
    _setOwnerOf(id, address(0));

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

    emit ERC721Events.Transfer(from_, address(0), 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;
  }
}

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

pragma solidity ^0.8.20;

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

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

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

File 9 of 19 : 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 10 of 19 : 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 11 of 19 : 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 12 of 19 : 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 13 of 19 : 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 DecimalsTooLow();
  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 (uint16[] 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 14 of 19 : 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.20;

/**
 * @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 15 of 19 : ERC721Events.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

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 16 of 19 : ERC20Events.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

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

File 17 of 19 : LinkedListInventory.sol
pragma solidity ^0.8.0;


struct Reference {
	uint16 prev;
	uint16 next;
}

struct LinkedListU16 {
	mapping( uint16 => uint16 ) positionOfToken;
	uint16[] tokens;
	Reference[] list;
	uint32 tailAndHeadIdx;
}

struct LinkedListStorage {
	mapping(address => LinkedListU16) self;
}

// import {console2 as c} from "forge-std/console2.sol";

library LinkedListInventory {
	using BitFieldU16 for bytes32;
	using BitFieldU16 for uint16;
	using BitFieldU16 for uint256;
	using LinkedListInventory for LinkedListStorage;

	error ValidateLinkedListError_ItemAlreadyVisited(uint16 tidIndex);
	error ValidateLinkedListError_PrematureTermination();
	error ValidateLinkedListError_NextTidIndexExceedsLength(uint16 tidIndex);

	function tids(LinkedListStorage storage s, address account) internal view returns (uint16[] memory) {
		return s.self[account].tokens;
	}

	function tidsOrdered(LinkedListStorage storage s, address account) internal view returns (uint16[] memory) {
		uint16 currIndex = s.getHeadIndex(account);
		uint256 len = s.length(account);

		uint16[] memory tids = new uint16[](len);

		for(uint256 i = 0; i < len; i++) {
			tids[len-(i+1)] = s.self[account].tokens[currIndex];
			currIndex = s.getReference(account, currIndex).next;
		}
		return tids;
	}

	function exists(LinkedListStorage storage s, address account, uint16 tid) internal view returns (bool) {
		return s.positionOfToken(account, tid) > 0;
	}

	function length(LinkedListStorage storage s, address account) internal view returns (uint256) {
		return s.self[account].tokens.length;
	}

	function getHeadIndex(LinkedListStorage storage s, address account) internal view returns (uint16 head) {
		( ,head) = s.getTailAndHeadIdx(account);
	}

	function getTailIndex(LinkedListStorage storage s, address account) internal view returns (uint16 tail) {
 		(tail,) = s.getTailAndHeadIdx(account);
	}
	function getTailAndHeadIdx(LinkedListStorage storage s, address account) internal view returns (uint16 tail, uint16 head) {
		uint32 tailAndHead = s.self[account].tailAndHeadIdx;
		head = uint16(tailAndHead & 0x0000FFFF);
		tail = uint16(tailAndHead >> 16);
	}

	function setTailAndHeadIdx(LinkedListStorage storage s, address account, uint16 tail, uint16 head) internal {
		uint32 tailAndHead;
		tailAndHead = uint32(tail) << 16;
		tailAndHead |= head;
		s.self[account].tailAndHeadIdx = tailAndHead;
	}

	function getHead(LinkedListStorage storage s, address account) internal view returns (uint16) {
		return s.self[account].tokens[s.getHeadIndex(account)];
	}

	function lastTokenAndIndex(LinkedListStorage storage s, address account) internal view returns (uint16, uint16) {
		uint16 lastIndex = uint16(s.self[account].tokens.length - 1);
		return (s.self[account].tokens[lastIndex], lastIndex);
	}

	function positionOfToken(LinkedListStorage storage s, address account, uint16 token) internal view returns (uint16) {
		return s.self[account].positionOfToken[token];
	}

	function getReference(LinkedListStorage storage s, address account, uint16 index) internal view returns (Reference memory) {
		return s.self[account].list[index];
	}

	// Get the list; also get the token array since you need them to do meaningful things with the list
	function getLinkedList(LinkedListStorage storage s, address account) internal view returns(
		Reference[] memory list,
		uint16 head,
		uint16[] memory tokens
	) {
		(, uint16 head) = s.getTailAndHeadIdx(account);
		return (s.self[account].list, head, s.self[account].tokens);
	}

	function inventoryTransferFrom(
		LinkedListStorage storage s,
		address from,
		address to,
		uint16 tid
	) internal {
		s.inventoryTransferOut(from, tid);
		s.inventoryTransferIn(to, tid);
	}

	function inventoryPopFrom(LinkedListStorage storage s, address from, address to) internal {
		uint16 tid = s.pop(from);
		s.inventoryTransferIn(to, tid);
	}

	function inventoryPopFrom(
		LinkedListStorage storage s,
		address from,
		address to,
		uint256 num
	) internal {
		for (uint256 i = 0; i < num; i++) {
			s.inventoryPopFrom(from, to);
		}
	}

	// UNSAFE: we assume that all 721 business logic like ownership mapping
	// has already been performed and all sanity checks have been passed.
	function inventoryTransferIn(
		LinkedListStorage storage s,
		address account,
		uint16 tid
	) internal {
		uint16 newEdgeIdx = uint16(s.self[account].tokens.length);
		(uint16 tailIdx, uint16 formerHeadIdx) = s.getTailAndHeadIdx(account);

		// Insert new tid as new head at end of list
		s.self[account].tokens.push(tid);
		Reference memory newRef = Reference({prev: 0, next: formerHeadIdx});

		// Update linked-list pointers accordingly if there is already an item in the list
		if (newEdgeIdx > 0) {
			newRef.next = formerHeadIdx;
			s.self[account].list[formerHeadIdx].prev = newEdgeIdx;
		}

		s.self[account].list.push(newRef);

		// Update metadata
		s.setTailAndHeadIdx(account, tailIdx, newEdgeIdx);
		// All positions are index + 1 to reserve 0th position for NULL
		s.self[account].positionOfToken[tid] = newEdgeIdx + 1;
	}

	function inventoryTransferOut(LinkedListStorage storage s, address account, uint16 tid) internal {
		uint16 hole = s.positionOfToken(account, tid) - 1;
		Reference memory holeRef = s.getReference(account, hole);

		if (s.self[account].list.length > 1) {
			(uint16 tail, uint16 head) = s.getTailAndHeadIdx(account);
			(uint16 edgeTid, uint16 edge) = s.lastTokenAndIndex(account);

			// STEP 1: Weld the neighbors of the new hole
			if ( hole == head ) {
				head = holeRef.next;
				// backlink does not matter in this case
			} else if ( hole == tail ) {
				tail = holeRef.prev;
				// fwd link also does not matter; walk will terminate early
			} else {
				// Dissolve the vertex.
				uint16 prev = holeRef.prev;
				uint16 next = holeRef.next;
				s.self[account].list[next].prev = prev;
				s.self[account].list[prev].next = next;
			}

			if ( edge != hole ) { // no array healing needed if we're deleting edge
				// STEP 2: Move the edge to the hole's position.
				Reference memory edgeRef = s.getReference(account, edge);
				uint16 prev = edgeRef.prev;
				uint16 next = edgeRef.next;
				if ( edge == head ) {
					head = hole;
					s.self[account].list[next].prev = hole;
				} else if ( edge == tail ) {
					tail = hole;
					s.self[account].list[prev].next = hole;
				} else {
					s.self[account].list[next].prev = hole;
					s.self[account].list[prev].next = hole;
				}

				//set hole pointers
				s.self[account].list[hole].prev = edgeRef.prev;
				s.self[account].list[hole].next = edgeRef.next;

				// Update lookup from edge to hole too
				s.self[account].positionOfToken[edgeTid] = hole + 1;
				s.self[account].tokens[hole] = edgeTid;
			}
			s.setTailAndHeadIdx(account, tail, head);
		} else {
			delete s.self[account].tailAndHeadIdx;
		}

		// Trim the (now invalid) edge of the array.
		s.self[account].tokens.pop();
		s.self[account].list.pop();

		delete s.self[account].positionOfToken[tid];
	}

	function pop(LinkedListStorage storage s, address account) internal returns (uint16 tid) {
		tid = s.getHead(account);
		s.inventoryTransferOut(account, tid);
	}

	/// @dev Avoids a redundant sload when writing the changed refs list
	uint16 private constant SET_REF_TO_ZERO = 0xFFFF;

	function _validateAndBuildList(uint16[] memory list, uint16 head) internal pure returns (Reference[] memory, uint32) {
		uint256 blen = uint16(list.length).bitmapLength();
		bytes32[] memory visitedBitmap = new bytes32[](blen);

		Reference[] memory built = new Reference[](list.length);
		uint32 tail_p;
		uint32 head_p = head;

		uint16 prev;
		uint16 current = head;

		for(uint256 i = 0; i < list.length - 1; i++) {
			uint256 bitmapIndex = current.bitmapIndex();
			bytes32 currBitfield = visitedBitmap[bitmapIndex];

			if (current >= list.length)
				revert ValidateLinkedListError_NextTidIndexExceedsLength(current);

			if (currBitfield.contains(current))
				revert ValidateLinkedListError_ItemAlreadyVisited(current);

			visitedBitmap[bitmapIndex] = currBitfield.set(current);

			if ( i > 0 ) {
				built[current].prev = prev;
			}

			built[current].next = list[current];

			prev = current;
			current = list[current];
		}

		built[current].prev = prev;
		tail_p = current;

		return (built, (tail_p << 16 | head_p));
	}


	function commitLinkedList(LinkedListStorage storage s, uint16[] calldata newList, uint16 newHead) internal {
		address account = msg.sender;
		(uint16 tailIdx, uint16 headIdx) = s.getTailAndHeadIdx(account);

		uint256 len = s.length(account);
		require( len > 0, "Nothing to reorder." );
		require( newList.length == len, "Wrong list size committed." );

		(Reference[] memory changeList, uint32 newTailAndHead) = _validateAndBuildList(newList, newHead);
		uint16 newTail = uint16(newTailAndHead >> 16);


		if (newHead != headIdx || newTail != tailIdx) {
			s.setTailAndHeadIdx(account, newTail, newHead);
		}

		/// @dev solc writes are packed in slots sequentially
		/// and evm load-check-stores already
		for(uint256 i = 0; i < changeList.length; i++) {
			s.self[account].list[i] = changeList[i];
		}
	}
}

library BitFieldU16 {

	function set(bytes32 bitfield, uint16 item) internal pure returns (bytes32) {
		uint16 index = item % 256;
		return bitfield | bytes32(0x01 << index);
	}

	function contains(bytes32 bitField, uint16 item) internal pure returns (bool) {
		uint16 index = item % 256;
		return uint256(bitField >> index) & 0x01 == 1;
	}

	function bitmapLength(uint16 item) internal pure returns (uint256 length) {
		length = bitmapIndex(item) + 1;
	}

	function visitBitmapAt(uint16 item) internal pure returns (uint256 index, uint16 position) {
		unchecked { index = item / 256; }
		position = uint16(item - (index * 256));
	}

	function bitmapIndex(uint16 item) internal pure returns (uint256 index) {
		unchecked {
			index = item / 256;
		}
	}
}

File 18 of 19 : 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 19 of 19 : 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);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"contract IMinter","name":"minter_","type":"address"},{"internalType":"address","name":"initialOwner_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyExists","type":"error"},{"inputs":[],"name":"DecimalsTooLow","type":"error"},{"inputs":[],"name":"InsufficientAllowance","type":"error"},{"inputs":[],"name":"InvalidApproval","type":"error"},{"inputs":[],"name":"InvalidExemption","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":[{"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"},{"inputs":[{"internalType":"uint16","name":"tidIndex","type":"uint16"}],"name":"ValidateLinkedListError_ItemAlreadyVisited","type":"error"},{"inputs":[{"internalType":"uint16","name":"tidIndex","type":"uint16"}],"name":"ValidateLinkedListError_NextTidIndexExceedsLength","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":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":[{"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":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"dequeueAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dequeueBack","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dequeueEmpty","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dequeueFront","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dequeueLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"account","type":"address"}],"name":"getOwnedLinkedList","outputs":[{"components":[{"internalType":"uint16","name":"prev","type":"uint16"},{"internalType":"uint16","name":"next","type":"uint16"}],"internalType":"struct Reference[]","name":"list","type":"tuple[]"},{"internalType":"uint16","name":"head","type":"uint16"},{"internalType":"uint16[]","name":"tokens","type":"uint16[]"}],"stateMutability":"view","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":[],"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":"uint16[]","name":"","type":"uint16[]"}],"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":"uint16[]","name":"newList","type":"uint16[]"},{"internalType":"uint16","name":"newHead","type":"uint16"}],"name":"reorderOwned","outputs":[],"stateMutability":"nonpayable","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":"baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"who","type":"address"},{"internalType":"bool","name":"whitelist","type":"bool"}],"name":"setERC721TransferExempt","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":"id_","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"},{"inputs":[],"name":"units","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

6101006040523480156200001257600080fd5b50604051620053aa380380620053aa8339810160408190526200003591620015c7565b8383836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000076573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200009c91906200165b565b836001600160a01b038116620000cc57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b620000d781620002af565b506003620000e6848262001715565b506004620000f5838262001715565b5060128160ff1610156200011c576040516398790fd560e01b815260040160405180910390fd5b60ff811660808190526200013290600a620018f4565b60a0524660c05262000143620002ff565b60e0525050604080516060810190915260318082526200016d92506200535960208301396200039b565b6000826001600160a01b031663976a84356040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001ae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001d4919062001905565b836001600160a01b031663047fc9aa6040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000213573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000239919062001905565b6200024591906200191f565b9050600060646200025883600c6200191f565b62000264919062001939565b905062000273846001620003ad565b6200027f848262000423565b6200028c836001620003ad565b620002a3836200029d83856200195c565b62000423565b50505050505062001a91565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600360405162000333919062001972565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600f620003a9828262001715565b5050565b6001600160a01b038216620003d55760405163a41e3d3f60e01b815260040160405180910390fd5b8015620003ed57620003e78262000493565b620003f8565b620003f882620004c2565b6001600160a01b03919091166000908152600d60205260409020805460ff1916911515919091179055565b6001600160a01b0382166200044b57604051634e46966960e11b815260040160405180910390fd5b600160ff1b81600554620004609190620019f0565b1115620004805760405163303b682f60e01b815260040160405180910390fd5b6200048e6000838362000536565b505050565b6000620004a0826200078d565b905060005b818110156200048e57620004b983620007b0565b600101620004a5565b60a051600090620004e8836001600160a01b031660009081526007602052604090205490565b620004f4919062001939565b9050600062000503836200078d565b905060005b6200051482846200195c565b811015620005305762000527846200084a565b60010162000508565b50505050565b6001600160a01b038381166000908152600760205260408082205492851682528120549091906200056986868662000940565b60006200057687620009f2565b905060006200058587620009f2565b9050818015620005925750805b6200077f5781156200060e57600060a05184620005b0919062001939565b60a0516001600160a01b038a16600090815260076020526040902054620005d8919062001939565b620005e491906200195c565b905060005b818110156200060657620005fd896200084a565b600101620005e9565b50506200077f565b80156200067b5760a0516001600160a01b03891660009081526007602052604081205490916200063e9162001939565b60a0516200064d908762001939565b6200065991906200195c565b905060005b818110156200060657620006728a620007b0565b6001016200065e565b600060a051876200068d919062001939565b905060005b81811015620006c7576000620006aa600c8c62000a25565b61ffff169050620006bd8b8b8362000a8f565b5060010162000692565b5060a0518190620006ed8b6001600160a01b031660009081526007602052604090205490565b620006f9919062001939565b60a05162000708908862001939565b6200071491906200195c565b111562000726576200072689620007b0565b8060a0518562000737919062001939565b60a0516001600160a01b038b166000908152600760205260409020546200075f919062001939565b6200076b91906200195c565b11156200077d576200077d886200084a565b505b506001979650505050505050565b6001600160a01b0381166000908152600c60205260408120600101545b92915050565b6001600160a01b038116620007d857604051636edaef2f60e11b815260040160405180910390fd5b6000620007e7600c8362000b59565b61ffff81166000908152600b6020526040902080546001600160a01b031916905590506200081b600161ffff831662000b76565b60405161ffff8216906000906001600160a01b038516906000805160206200538a833981519152908390a45050565b6001600160a01b0381166200087257604051634e46966960e11b815260040160405180910390fd5b600062000893600154600160801b81046001600160801b0390811691161490565b620008ac57620008a4600162000be1565b9050620008fb565b600660008154620008bd9062001a06565b90915550600654600101620008e55760405163303b682f60e01b815260040160405180910390fd5b600654620008f890600160ff1b620019f0565b90505b6000818152600b60205260409020546001600160a01b03168015620009335760405163119b4fd360e11b815260040160405180910390fd5b6200048e81848462000a8f565b6001600160a01b0383166200096f578060056000828254620009639190620019f0565b909155506200099f9050565b6001600160a01b03831660009081526007602052604081208054839290620009999084906200195c565b90915550505b6001600160a01b03808316600081815260076020526040908190208054850190555190918516906000805160206200538a83398151915290620009e59085815260200190565b60405180910390a3505050565b60006001600160a01b0382161580620007aa5750506001600160a01b03166000908152600d602052604090205460ff1690565b6001600160a01b0381166000908152602083905260408120600381015460019091019061ffff1661ffff168154811062000a635762000a6362001a22565b90600052602060002090601091828204019190066002029054906101000a900461ffff16905092915050565b6001600160a01b0383161562000ac957600081815260096020526040902080546001600160a01b031916905562000ac9600c848362000c52565b6001600160a01b0382161562000b14576000818152600b6020526040902080546001600160a01b0319166001600160a01b03841601905562000b0e600c838362001235565b62000b24565b6000818152600b60205260408120555b80826001600160a01b0316846001600160a01b03166000805160206200538a83398151915260405160405180910390a4505050565b600062000b67838362000a25565b9050620007aa83838362000c52565b81546001600160801b038082166000190191600160801b900481169082160362000bb357604051638acb5f2760e01b815260040160405180910390fd5b6001600160801b0316600081815260018401602052604090209190915581546001600160801b031916179055565b80546000906001600160801b03600160801b820481169116810362000c19576040516375e52f4f60e01b815260040160405180910390fd5b600019016001600160801b039081166000818152600185016020526040812080549190558454909216600160801b909102179092555090565b6001600160a01b03821660009081526020848152604080832061ffff8581168552925282205462000c87916001911662001a38565b9050600062000c98858584620013d8565b6001600160a01b0385166000908152602087905260409020600201549091506001101562001132576001600160a01b03841660009081526020869052604081206003015461ffff601082901c8116929116908062000cf7898962001457565b915091508261ffff168661ffff160362000d18578460200151925062000de7565b8361ffff168661ffff160362000d32578451935062000de7565b84516020808701516001600160a01b038b166000908152918c90526040909120600201805483919061ffff841690811062000d715762000d7162001a22565b6000918252602080832091909101805461ffff191661ffff9485161790556001600160a01b038d1682528d90526040902060020180548392851690811062000dbd5762000dbd62001a22565b9060005260206000200160000160026101000a81548161ffff021916908361ffff16021790555050505b8561ffff168161ffff1614620010f057600062000e068a8a84620013d8565b805160208201519192509061ffff8087169085160362000e7f576001600160a01b038b16600090815260208d90526040902060020180548a975087919061ffff841690811062000e5a5762000e5a62001a22565b6000918252602090912001805461ffff191661ffff9290921691909117905562000fa1565b8661ffff168461ffff160362000ef6576001600160a01b038b16600090815260208d90526040902060020180548a985088919061ffff851690811062000ec95762000ec962001a22565b9060005260206000200160000160026101000a81548161ffff021916908361ffff16021790555062000fa1565b6001600160a01b038b16600090815260208d90526040902060020180548a919061ffff841690811062000f2d5762000f2d62001a22565b6000918252602080832091909101805461ffff191661ffff9485161790556001600160a01b038e1682528e90526040902060020180548b92851690811062000f795762000f7962001a22565b9060005260206000200160000160026101000a81548161ffff021916908361ffff1602179055505b82516001600160a01b038c16600090815260208e905260409020600201805461ffff8c1690811062000fd75762000fd762001a22565b6000918252602080832091909101805461ffff191661ffff948516179055858101516001600160a01b038f168352908f90526040909120600201805491929091908c169081106200102c576200102c62001a22565b6000918252602090912001805461ffff92909216620100000263ffff0000199092169190911790556200106189600162001a5d565b6001600160a01b038c16600081815260208f8152604080832061ffff8b81168552818452918420805461ffff191696831696909617909555929091528e90526001909101805487928c16908110620010bd57620010bd62001a22565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff1602179055505050505b6001600160a01b038816600090815260208a905260409020600301805463ffffffff191661ffff851663ffff0000601088901b16171790555050505062001159565b6001600160a01b0384166000908152602086905260409020600301805463ffffffff191690555b6001600160a01b038416600090815260208690526040902060010180548062001186576200118662001a7b565b60008281526020808220601060001994909401938404018054600f851660029081026101000a61ffff0219909116909155929093556001600160a01b038716815291879052604090912001805480620011e357620011e362001a7b565b600082815260208082208301600019908101805463ffffffff191690559092019092556001600160a01b0390951681529484525050604080842061ffff92909216845291529020805461ffff19169055565b6001600160a01b038216600090815260208481526040808320600180820180546003909301549183018155855283852060108084049091018054600f85166002026101000a61ffff818102199092168a8316919091021790915584518086019095529584528582169484018590529194911c8116929190841615620013115761ffff821660208083018290526001600160a01b0388166000908152908990526040902060020180548692908110620012f157620012f162001a22565b6000918252602090912001805461ffff191661ffff929092169190911790555b6001600160a01b03861660008181526020898152604082206002810180546001810182559084528284208651910180549387015161ffff908116620100000263ffffffff1995861693821693909317929092179055939092526003909101805490911691861663ffff0000601087901b16179190911790556200139684600162001a5d565b6001600160a01b039690961660009081526020978852604080822061ffff978816835290985296909620805461ffff1916949095169390931790935550505050565b60408051808201909152600080825260208201526001600160a01b0383166000908152602085905260409020600201805461ffff841690811062001420576200142062001a22565b60009182526020918290206040805180820190915291015461ffff8082168352620100009091041691810191909152949350505050565b6001600160a01b0381166000908152602083905260408120600190810154829182916200148591906200195c565b6001600160a01b038516600090815260208790526040902060010180549192509061ffff8316908110620014bd57620014bd62001a22565b60009182526020909120601082040154600f9091166002026101000a900461ffff169590945092505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200151157600080fd5b81516001600160401b03808211156200152e576200152e620014e9565b604051601f8301601f19908116603f01168101908282118183101715620015595762001559620014e9565b816040528381526020925086838588010111156200157657600080fd5b600091505b838210156200159a57858201830151818301840152908201906200157b565b600093810190920192909252949350505050565b6001600160a01b0381168114620015c457600080fd5b50565b60008060008060808587031215620015de57600080fd5b84516001600160401b0380821115620015f657600080fd5b6200160488838901620014ff565b955060208701519150808211156200161b57600080fd5b506200162a87828801620014ff565b93505060408501516200163d81620015ae565b60608601519092506200165081620015ae565b939692955090935050565b6000602082840312156200166e57600080fd5b815160ff811681146200168057600080fd5b9392505050565b600181811c908216806200169c57607f821691505b602082108103620016bd57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200048e57600081815260208120601f850160051c81016020861015620016ec5750805b601f850160051c820191505b818110156200170d57828155600101620016f8565b505050505050565b81516001600160401b03811115620017315762001731620014e9565b620017498162001742845462001687565b84620016c3565b602080601f831160018114620017815760008415620017685750858301515b600019600386901b1c1916600185901b1785556200170d565b600085815260208120601f198616915b82811015620017b25788860151825594840194600190910190840162001791565b5085821015620017d15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115620018385781600019048211156200181c576200181c620017e1565b808516156200182a57918102915b93841c9390800290620017fc565b509250929050565b6000826200185157506001620007aa565b816200186057506000620007aa565b81600181146200187957600281146200188457620018a4565b6001915050620007aa565b60ff841115620018985762001898620017e1565b50506001821b620007aa565b5060208310610133831016604e8410600b8410161715620018c9575081810a620007aa565b620018d58383620017f7565b8060001904821115620018ec57620018ec620017e1565b029392505050565b60006200168060ff84168362001840565b6000602082840312156200191857600080fd5b5051919050565b8082028115828204841417620007aa57620007aa620017e1565b6000826200195757634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115620007aa57620007aa620017e1565b6000808354620019828162001687565b600182811680156200199d5760018114620019b357620019e4565b60ff1984168752821515830287019450620019e4565b8760005260208060002060005b85811015620019db5781548a820152908401908201620019c0565b50505082870194505b50929695505050505050565b80820180821115620007aa57620007aa620017e1565b60006001820162001a1b5762001a1b620017e1565b5060010190565b634e487b7160e01b600052603260045260246000fd5b61ffff82811682821603908082111562001a565762001a56620017e1565b5092915050565b61ffff81811683821601908082111562001a565762001a56620017e1565b634e487b7160e01b600052603160045260246000fd5b60805160a05160c05160e05161384162001b1860003960006108a4015260006108740152600081816105180152818161114b015281816119180152818161195c015281816119d5015281816119ff01528181611a5301528181611ab001528181611afd01528181611b4101528181611b6801526122b8015260006103cb01526138416000f3fe608060405234801561001057600080fd5b50600436106102a05760003560e01c806389fb4c6611610167578063c5ab3ba6116100ce578063dd62ed3e11610087578063dd62ed3e1461060a578063dd63769914610635578063dfabc03314610648578063e985e9c51461065b578063f2fde38b14610689578063f780bc1a1461069c57600080fd5b8063c5ab3ba6146105ae578063c6a6f41b146105b6578063c6e672b9146105be578063c87b56dd146105d1578063d505accf146105e4578063d96ca0b9146105f757600080fd5b8063a22cb46511610120578063a22cb46514610542578063a9059cbb14610555578063b1ab931714610568578063b3f9ea3414610588578063b88d4fde1461059b578063bc2ffd3b1461036d57600080fd5b806389fb4c66146104df5780638a696e50146104e75780638da5cb5b146104fa57806395d89b411461050b578063976a84351461051357806399d292a71461053a57600080fd5b8063388551341161020b5780636a4a0ead116101c45780636a4a0ead146104665780636cb3cac8146104795780636e8f624b1461048c57806370a0823114610497578063715018a6146104b75780637ecebe00146104bf57600080fd5b8063388551341461040757806342842e0e1461040f5780634d966072146104245780634f02c4201461043757806355f804b3146104405780636352211e1461045357600080fd5b806309f0ef651161025d57806309f0ef65146103755780630de667001461038857806318160ddd146103aa57806323b872dd146103b3578063313ce567146103c65780633644e515146103ff57600080fd5b806301ffc9a7146102a557806302519da3146102cd57806306fdde0314610304578063081812fc14610319578063095ea7b31461035a57806309674eb01461036d575b600080fd5b6102b86102b3366004612f84565b6106bc565b60405190151581526020015b60405180910390f35b6102f66102db366004612fb8565b6001600160a01b031660009081526007602052604090205490565b6040519081526020016102c4565b61030c6106f3565b6040516102c49190613023565b610342610327366004613036565b6009602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102c4565b6102b861036836600461304f565b610781565b6102f66107ba565b6102b8610383366004612fb8565b6107e4565b61039b610396366004612fb8565b610816565b6040516102c4939291906130b8565b6102f660055481565b6102b86103c136600461312d565b610833565b6103ed7f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016102c4565b6102f6610870565b6102f66108c6565b61042261041d36600461312d565b6108d2565b005b6102b861043236600461304f565b6108f2565b6102f660065481565b61042261044e3660046131f5565b61097f565b610342610461366004613036565b610993565b61042261047436600461323e565b6109fd565b6102f6610487366004613036565b610a0a565b6102f6600160ff1b81565b6102f66104a5366004612fb8565b60076020526000908152604090205481565b610422610a17565b6102f66104cd366004612fb8565b600e6020526000908152604090205481565b6005546102f6565b6104226104f53660046132db565b610a2b565b6000546001600160a01b0316610342565b61030c610a35565b6102f67f000000000000000000000000000000000000000000000000000000000000000081565b6102b8610a42565b6104226105503660046132f6565b610a4e565b6102b861056336600461304f565b610ae1565b61057b610576366004612fb8565b610b15565b6040516102c49190613329565b6102f6610596366004612fb8565b610b22565b6104226105a936600461333c565b610b43565b6006546102f6565b6102f6610c31565b6104226105cc3660046132f6565b610c3d565b61030c6105df366004613036565b610c53565b6104226105f23660046133b8565b610d16565b6102b861060536600461312d565b610f59565b6102f661061836600461342b565b600860209081526000928352604080842090915290825290205481565b61042261064336600461312d565b611019565b61042261065636600461304f565b61117a565b6102b861066936600461342b565b600a60209081526000928352604080842090915290825290205460ff1681565b610422610697366004612fb8565b61123f565b6106af6106aa366004613455565b61127f565b6040516102c49190613477565b60006001600160e01b0319821663caf91ff560e01b14806106ed57506001600160e01b031982166301ffc9a760e01b145b92915050565b60038054610700906134bb565b80601f016020809104026020016040519081016040528092919081815260200182805461072c906134bb565b80156107795780601f1061074e57610100808354040283529160200191610779565b820191906000526020600020905b81548152906001019060200180831161075c57829003601f168201915b505050505081565b600061078c8261131c565b156107a05761079b838361117a565b6107b1565b6107aa83836108f2565b90506106ed565b50600192915050565b60006107df6001546001600160801b03808216600160801b9092048116919091031690565b905090565b60006001600160a01b03821615806106ed5750506001600160a01b03166000908152600d602052604090205460ff1690565b6060600081610826600c85611335565b9250925092509193909250565b600061083e8261131c565b156108535761084e848484611019565b610865565b61085e848484610f59565b9050610869565b5060015b9392505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146108a1576107df611459565b507f000000000000000000000000000000000000000000000000000000000000000090565b60006107df60016114f3565b6108ed83838360405180602001604052806000815250610b43565b505050565b60006001600160a01b03831661091b57604051635461585f60e01b815260040160405180910390fd5b3360008181526008602090815260408083206001600160a01b03881680855290835292819020869055518581529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350600192915050565b61098761153d565b6109908161156a565b50565b6000818152600b60205260409020546001600160a01b03166109b48261131c565b6109d1576040516307ed98ed60e31b815260040160405180910390fd5b6001600160a01b0381166109f85760405163c5723b5160e01b815260040160405180910390fd5b919050565b6108ed600c848484611576565b60006106ed60018361176f565b610a1f61153d565b610a2960006117da565b565b610990338261182a565b60048054610700906134bb565b60006107df6001611899565b6001600160a01b038216610a755760405163ccea9e6f60e01b815260040160405180910390fd5b336000818152600a602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60006001600160a01b038316610b0a57604051634e46966960e11b815260040160405180910390fd5b6108693384846118b2565b60606106ed600c83611bd9565b6001600160a01b0381166000908152600c60205260408120600101546106ed565b610b4c8261131c565b610b69576040516307ed98ed60e31b815260040160405180910390fd5b610b74848484610833565b506001600160a01b0383163b15801590610c0d5750604051630a85bd0160e11b808252906001600160a01b0385169063150b7a0290610bbd9033908990889088906004016134f5565b6020604051808303816000875af1158015610bdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c009190613532565b6001600160e01b03191614155b15610c2b57604051633da6393160e01b815260040160405180910390fd5b50505050565b60006107df6001611d0f565b610c4561153d565b610c4f828261182a565b5050565b60606000600f8054610c64906134bb565b80601f0160208091040260200160405190810160405280929190818152602001828054610c90906134bb565b8015610cdd5780601f10610cb257610100808354040283529160200191610cdd565b820191906000526020600020905b815481529060010190602001808311610cc057829003601f168201915b5050505050905080610cee84611d67565b604051602001610cff92919061354f565b604051602081830303815290604052915050919050565b42841015610d37576040516305787bdf60e01b815260040160405180910390fd5b610d408561131c565b15610d5e576040516303e7c1bd60e31b815260040160405180910390fd5b6001600160a01b038616610d8557604051635461585f60e01b815260040160405180910390fd5b60006001610d91610870565b6001600160a01b038a81166000818152600e602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610e9d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381161580610ed25750876001600160a01b0316816001600160a01b031614155b15610ef057604051632057875960e21b815260040160405180910390fd5b6001600160a01b0390811660009081526008602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b60006001600160a01b038416610f8257604051636edaef2f60e11b815260040160405180910390fd5b6001600160a01b038316610fa957604051634e46966960e11b815260040160405180910390fd5b6001600160a01b0384166000908152600860209081526040808320338452909152902054600019811461100557610fe08382613594565b6001600160a01b03861660009081526008602090815260408083203384529091529020555b6110108585856118b2565b95945050505050565b6001600160a01b03831661104057604051636edaef2f60e11b815260040160405180910390fd5b6001600160a01b03821661106757604051634e46966960e11b815260040160405180910390fd5b6000818152600b60205260409020546001600160a01b038481169116146110a0576040516282b42960e81b815260040160405180910390fd5b336001600160a01b038416148015906110dd57506001600160a01b0383166000908152600a6020908152604080832033845290915290205460ff16155b801561110057506000818152600960205260409020546001600160a01b03163314155b1561111d576040516282b42960e81b815260040160405180910390fd5b611126826107e4565b1561114457604051635ce7539760e01b815260040160405180910390fd5b61116f83837f0000000000000000000000000000000000000000000000000000000000000000611dfa565b6108ed838383611eb6565b6000818152600b60205260409020546001600160a01b03163381148015906111c657506001600160a01b0381166000908152600a6020908152604080832033845290915290205460ff16155b156111e3576040516282b42960e81b815260040160405180910390fd5b60008281526009602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b61124761153d565b6001600160a01b03811661127657604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610990816117da565b606060008267ffffffffffffffff81111561129c5761129c613169565b6040519080825280602002602001820160405280156112c5578160200160208202803683370190505b509050835b6112d484866135a7565b811015611314576112e660018261176f565b826112f18784613594565b81518110611301576113016135ba565b60209081029190910101526001016112ca565b509392505050565b6000600160ff1b821180156106ed575050600019141590565b6060600081816113458686611f6d565b6001600160a01b03871660009081526020898152604080832060028101805483518186028101860190945280845295975095508694600190910193919286929084015b828210156113cb576000848152602090819020604080518082019091529084015461ffff8082168352620100009091041681830152825260019092019101611388565b5050505092508080548060200260200160405190810160405280929190818152602001828054801561144457602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff168152602001906002019060208260010104928301926001038202915080841161140b5790505b50505050509050935093509350509250925092565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600360405161148b91906135d0565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b60006114fe82611899565b1561151c576040516375e52f4f60e01b815260040160405180910390fd5b5080546001600160801b031660009081526001909101602052604090205490565b6000546001600160a01b03163314610a295760405163118cdaa760e01b815233600482015260240161126d565b600f610c4f8282613694565b336000806115848784611f6d565b6001600160a01b038516600090815260208a905260409020600101549193509150806115e85760405162461bcd60e51b81526020600482015260136024820152722737ba3434b733903a37903932b7b93232b91760691b604482015260640161126d565b8581146116375760405162461bcd60e51b815260206004820152601a60248201527f57726f6e67206c6973742073697a6520636f6d6d69747465642e000000000000604482015260640161126d565b6000806116788989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b9250611f99915050565b91509150600060108263ffffffff16901c90508461ffff168861ffff161415806116aa57508561ffff168161ffff1614155b156116bb576116bb8b88838b61222a565b60005b8351811015611761578381815181106116d9576116d96135ba565b60200260200101518c60000160008a6001600160a01b03166001600160a01b03168152602001908152602001600020600201828154811061171c5761171c6135ba565b6000918252602091829020835191018054939092015161ffff908116620100000263ffffffff199094169116179190911790558061175981613754565b9150506116be565b505050505050505050505050565b600061179383546001600160801b03808216600160801b9092048116919091031690565b82106117b25760405163580821e760e01b815260040160405180910390fd5b5081546001600160801b03908116820116600090815260018301602052604090205492915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0382166118515760405163a41e3d3f60e01b815260040160405180910390fd5b80156118655761186082612270565b61186e565b61186e82612299565b6001600160a01b03919091166000908152600d60205260409020805460ff1916911515919091179055565b54600160801b81046001600160801b0390811691161490565b6001600160a01b038381166000908152600760205260408082205492851682528120549091906118e3868686611dfa565b60006118ee876107e4565b905060006118fb876107e4565b90508180156119075750805b611bcb5781156119b057600061193d7f000000000000000000000000000000000000000000000000000000000000000085613783565b6001600160a01b038916600090815260076020526040902054611981907f000000000000000000000000000000000000000000000000000000000000000090613783565b61198b9190613594565b905060005b818110156119a9576119a189612311565b600101611990565b5050611bcb565b8015611a4c576001600160a01b0388166000908152600760205260408120546119fa907f000000000000000000000000000000000000000000000000000000000000000090613783565b611a247f000000000000000000000000000000000000000000000000000000000000000087613783565b611a2e9190613594565b905060005b818110156119a957611a448a6123e5565b600101611a33565b6000611a787f000000000000000000000000000000000000000000000000000000000000000088613783565b905060005b81811015611aac576000611a92600c8c612479565b61ffff169050611aa38b8b83611eb6565b50600101611a7d565b50807f0000000000000000000000000000000000000000000000000000000000000000611aee8b6001600160a01b031660009081526007602052604090205490565b611af89190613783565b611b227f000000000000000000000000000000000000000000000000000000000000000088613783565b611b2c9190613594565b1115611b3b57611b3b896123e5565b80611b667f000000000000000000000000000000000000000000000000000000000000000086613783565b7f0000000000000000000000000000000000000000000000000000000000000000611ba68b6001600160a01b031660009081526007602052604090205490565b611bb09190613783565b611bba9190613594565b1115611bc957611bc988612311565b505b506001979650505050505050565b60606000611be784846124de565b6001600160a01b0384166000908152602086905260408120600101549192508167ffffffffffffffff811115611c1f57611c1f613169565b604051908082528060200260200182016040528015611c48578160200160208202803683370190505b50905060005b82811015611d05576001600160a01b0386166000908152602088905260409020600101805461ffff8616908110611c8757611c876135ba565b60009182526020909120601082040154600f9091166002026101000a900461ffff1682611cb58360016135a7565b611cbf9086613594565b81518110611ccf57611ccf6135ba565b61ffff90921660209283029190910190910152611ced8787866124f2565b60200151935080611cfd81613754565b915050611c4e565b5095945050505050565b6000611d1a82611899565b15611d38576040516375e52f4f60e01b815260040160405180910390fd5b5080546000196001600160801b03600160801b9092048216011660009081526001909101602052604090205490565b60606000611d748361256e565b600101905060008167ffffffffffffffff811115611d9457611d94613169565b6040519080825280601f01601f191660200182016040528015611dbe576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611dc857509392505050565b6001600160a01b038316611e25578060056000828254611e1a91906135a7565b90915550611e539050565b6001600160a01b03831660009081526007602052604081208054839290611e4d908490613594565b90915550505b6001600160a01b03808316600081815260076020526040908190208054850190555190918516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611ea99085815260200190565b60405180910390a3505050565b6001600160a01b03831615611eed57600081815260096020526040902080546001600160a01b0319169055611eed600c8483612646565b6001600160a01b03821615611f1757611f068183612bb1565b611f12600c8383612be0565b611f27565b6000818152600b60205260408120555b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6001600160a01b03166000908152602091909152604090206003015461ffff601082901c811692911690565b6060600080611fac855161ffff16612d7f565b905060008167ffffffffffffffff811115611fc957611fc9613169565b604051908082528060200260200182016040528015611ff2578160200160208202803683370190505b5090506000865167ffffffffffffffff81111561201157612011613169565b60405190808252806020026020018201604052801561205657816020015b604080518082019091526000808252602082015281526020019060019003908161202f5790505b509050600061ffff87168188815b60018c516120729190613594565b8110156121e057600061010061ffff80851691909104169050600088828151811061209f5761209f6135ba565b602002602001015190508d518461ffff16106120d4576040516319c3f23160e11b815261ffff8516600482015260240161126d565b6120de8185612d9e565b15612102576040516308c2ae1560e11b815261ffff8516600482015260240161126d565b61210c8185612dc2565b89838151811061211e5761211e6135ba565b6020908102919091010152821561215a5784888561ffff1681518110612146576121466135ba565b602090810291909101015161ffff90911690525b8d8461ffff1681518110612170576121706135ba565b6020026020010151888561ffff168151811061218e5761218e6135ba565b60200260200101516020019061ffff16908161ffff16815250508394508d8461ffff16815181106121c1576121c16135ba565b60200260200101519350505080806121d890613754565b915050612064565b5081858261ffff16815181106121f8576121f86135ba565b602090810291909101015161ffff919091169052939a60109490941b63ffff0000169091179850919650505050505050565b6001600160a01b0390921660009081526020939093526040909220600301805463ffffffff191661ffff9290921663ffff000060109490941b9390931692909217179055565b600061227b82610b22565b905060005b818110156108ed57612291836123e5565b600101612280565b6001600160a01b0381166000908152600760205260408120546122dd907f000000000000000000000000000000000000000000000000000000000000000090613783565b905060006122ea83610b22565b905060005b6122f98284613594565b811015610c2b5761230984612311565b6001016122ef565b6001600160a01b03811661233857604051634e46966960e11b815260040160405180910390fd5b60006123446001611899565b612359576123526001612de5565b90506123a3565b60066000815461236890613754565b9091555060065460010161238f5760405163303b682f60e01b815260040160405180910390fd5b6006546123a090600160ff1b6135a7565b90505b6000818152600b60205260409020546001600160a01b031680156123da5760405163119b4fd360e11b815260040160405180910390fd5b6108ed818484611eb6565b6001600160a01b03811661240c57604051636edaef2f60e11b815260040160405180910390fd5b6000612419600c83612e55565b905061242a8161ffff166000612bb1565b612439600161ffff8316612e6e565b60405161ffff8216906000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b038116600090815260208390526040812060010161249e84846124de565b61ffff16815481106124b2576124b26135ba565b90600052602060002090601091828204019190066002029054906101000a900461ffff16905092915050565b60006124ea8383611f6d565b949350505050565b60408051808201909152600080825260208201526001600160a01b0383166000908152602085905260409020600201805461ffff8416908110612537576125376135ba565b60009182526020918290206040805180820190915291015461ffff8082168352620100009091041691810191909152949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106125ad5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106125d9576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106125f757662386f26fc10000830492506010015b6305f5e100831061260f576305f5e100830492506008015b612710831061262357612710830492506004015b60648310612635576064830492506002015b600a83106106ed5760010192915050565b6001600160a01b03821660009081526020848152604080832061ffff858116855292528220546126799160019116613797565b905060006126888585846124f2565b6001600160a01b03851660009081526020879052604090206002015490915060011015612ab4576000806126bc8787611f6d565b90925090506000806126ce8989612ee1565b915091508261ffff168661ffff16036126ed57846020015192506127b4565b8361ffff168661ffff160361270557845193506127b4565b84516020808701516001600160a01b038b166000908152918c90526040909120600201805483919061ffff8416908110612741576127416135ba565b6000918252602080832091909101805461ffff191661ffff9485161790556001600160a01b038d1682528d90526040902060020180548392851690811061278a5761278a6135ba565b9060005260206000200160000160026101000a81548161ffff021916908361ffff16021790555050505b8561ffff168161ffff1614612a9f5760006127d08a8a846124f2565b805160208201519192509061ffff80871690851603612844576001600160a01b038b16600090815260208d90526040902060020180548a975087919061ffff8416908110612820576128206135ba565b6000918252602090912001805461ffff191661ffff9290921691909117905561295b565b8661ffff168461ffff16036128b6576001600160a01b038b16600090815260208d90526040902060020180548a985088919061ffff851690811061288a5761288a6135ba565b9060005260206000200160000160026101000a81548161ffff021916908361ffff16021790555061295b565b6001600160a01b038b16600090815260208d90526040902060020180548a919061ffff84169081106128ea576128ea6135ba565b6000918252602080832091909101805461ffff191661ffff9485161790556001600160a01b038e1682528e90526040902060020180548b928516908110612933576129336135ba565b9060005260206000200160000160026101000a81548161ffff021916908361ffff1602179055505b82516001600160a01b038c16600090815260208e905260409020600201805461ffff8c1690811061298e5761298e6135ba565b6000918252602080832091909101805461ffff191661ffff948516179055858101516001600160a01b038f168352908f90526040909120600201805491929091908c169081106129e0576129e06135ba565b6000918252602090912001805461ffff92909216620100000263ffff000019909216919091179055612a138960016137b9565b6001600160a01b038c16600081815260208f8152604080832061ffff8b81168552818452918420805461ffff191696831696909617909555929091528e90526001909101805487928c16908110612a6c57612a6c6135ba565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff1602179055505050505b612aab8989868661222a565b50505050612adb565b6001600160a01b0384166000908152602086905260409020600301805463ffffffff191690555b6001600160a01b0384166000908152602086905260409020600101805480612b0557612b056137d4565b60008281526020808220601060001994909401938404018054600f851660029081026101000a61ffff0219909116909155929093556001600160a01b038716815291879052604090912001805480612b5f57612b5f6137d4565b600082815260208082208301600019908101805463ffffffff191690559092019092556001600160a01b0390951681529484525050604080842061ffff92909216845291529020805461ffff19169055565b6000918252600b602052604090912080546001600160a01b0319166001600160a01b0392909216919091019055565b6001600160a01b0382166000908152602084905260408120600101549080612c088686611f6d565b6001600160a01b038716600090815260208981526040808320600190810180549182018155845282842060108204018054600f9092166002026101000a61ffff818102199093168c841691909102179055815180830190925292815283831691810191909152929450909250841615612cd55761ffff821660208083018290526001600160a01b0388166000908152908990526040902060020180548692908110612cb557612cb56135ba565b6000918252602090912001805461ffff191661ffff929092169190911790555b6001600160a01b03861660009081526020888152604082206002018054600181018255908352918190208351920180549184015161ffff908116620100000263ffffffff19909316931692909217179055612d328787858761222a565b612d3d8460016137b9565b6001600160a01b039690961660009081526020978852604080822061ffff978816835290985296909620805461ffff1916949095169390931790935550505050565b6000612d938261010061ffff918216041690565b6106ed9060016135a7565b600080612dad610100846137ea565b61ffff169390931c6001908116149392505050565b600080612dd1610100846137ea565b600161ffff9091161b841791505092915050565b80546000906001600160801b03600160801b8204811691168103612e1c576040516375e52f4f60e01b815260040160405180910390fd5b600019016001600160801b039081166000818152600185016020526040812080549190558454909216600160801b909102179092555090565b6000612e618383612479565b90506106ed838383612646565b81546001600160801b038082166000190191600160801b9004811690821603612eaa57604051638acb5f2760e01b815260040160405180910390fd5b6001600160801b0316600081815260018401602052604090209190915581546fffffffffffffffffffffffffffffffff1916179055565b6001600160a01b038116600090815260208390526040812060019081015482918291612f0d9190613594565b6001600160a01b038516600090815260208790526040902060010180549192509061ffff8316908110612f4257612f426135ba565b60009182526020909120601082040154600f9091166002026101000a900461ffff169590945092505050565b6001600160e01b03198116811461099057600080fd5b600060208284031215612f9657600080fd5b813561086981612f6e565b80356001600160a01b03811681146109f857600080fd5b600060208284031215612fca57600080fd5b61086982612fa1565b60005b83811015612fee578181015183820152602001612fd6565b50506000910152565b6000815180845261300f816020860160208601612fd3565b601f01601f19169290920160200192915050565b6020815260006108696020830184612ff7565b60006020828403121561304857600080fd5b5035919050565b6000806040838503121561306257600080fd5b61306b83612fa1565b946020939093013593505050565b600081518084526020808501945080840160005b838110156130ad57815161ffff168752958201959082019060010161308d565b509495945050505050565b606080825284519082018190526000906020906080840190828801845b82811015613104578151805161ffff9081168652908601511685850152604090930192908401906001016130d5565b50505061ffff86168285015283810360408501526131228186613079565b979650505050505050565b60008060006060848603121561314257600080fd5b61314b84612fa1565b925061315960208501612fa1565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561319a5761319a613169565b604051601f8501601f19908116603f011681019082821181831017156131c2576131c2613169565b816040528093508581528686860111156131db57600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561320757600080fd5b813567ffffffffffffffff81111561321e57600080fd5b8201601f8101841361322f57600080fd5b6124ea8482356020840161317f565b60008060006040848603121561325357600080fd5b833567ffffffffffffffff8082111561326b57600080fd5b818601915086601f83011261327f57600080fd5b81358181111561328e57600080fd5b8760208260051b85010111156132a357600080fd5b6020928301955093505084013561ffff811681146132c057600080fd5b809150509250925092565b803580151581146109f857600080fd5b6000602082840312156132ed57600080fd5b610869826132cb565b6000806040838503121561330957600080fd5b61331283612fa1565b9150613320602084016132cb565b90509250929050565b6020815260006108696020830184613079565b6000806000806080858703121561335257600080fd5b61335b85612fa1565b935061336960208601612fa1565b925060408501359150606085013567ffffffffffffffff81111561338c57600080fd5b8501601f8101871361339d57600080fd5b6133ac8782356020840161317f565b91505092959194509250565b600080600080600080600060e0888a0312156133d357600080fd5b6133dc88612fa1565b96506133ea60208901612fa1565b95506040880135945060608801359350608088013560ff8116811461340e57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561343e57600080fd5b61344783612fa1565b915061332060208401612fa1565b6000806040838503121561346857600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b818110156134af57835183529284019291840191600101613493565b50909695505050505050565b600181811c908216806134cf57607f821691505b6020821081036134ef57634e487b7160e01b600052602260045260246000fd5b50919050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061352890830184612ff7565b9695505050505050565b60006020828403121561354457600080fd5b815161086981612f6e565b60008351613561818460208801612fd3565b835190830190613575818360208801612fd3565b01949350505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106ed576106ed61357e565b808201808211156106ed576106ed61357e565b634e487b7160e01b600052603260045260246000fd5b60008083546135de816134bb565b600182811680156135f6576001811461360b5761363a565b60ff198416875282151583028701945061363a565b8760005260208060002060005b858110156136315781548a820152908401908201613618565b50505082870194505b50929695505050505050565b601f8211156108ed57600081815260208120601f850160051c8101602086101561366d5750805b601f850160051c820191505b8181101561368c57828155600101613679565b505050505050565b815167ffffffffffffffff8111156136ae576136ae613169565b6136c2816136bc84546134bb565b84613646565b602080601f8311600181146136f757600084156136df5750858301515b600019600386901b1c1916600185901b17855561368c565b600085815260208120601f198616915b8281101561372657888601518255948401946001909101908401613707565b50858210156137445787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000600182016137665761376661357e565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826137925761379261376d565b500490565b61ffff8281168282160390808211156137b2576137b261357e565b5092915050565b61ffff8181168382160190808211156137b2576137b261357e565b634e487b7160e01b600052603160045260246000fd5b600061ffff808416806137ff576137ff61376d565b9216919091069291505056fea2646970667358221220feaad0b6b48416c3e69b7054ab8290ade0903ba9cab25224307e5d796e22d3d064736f6c6343000814003368747470733a2f2f70697869657265616c6d2e696f2f6170692f70697869653430343f6d6f64653d6d657461267469643dddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000d978631f3e9469df439e7c311f5551f2d94c072000000000000000000000000f9211b7e2285cfb2acae6693fc465fdcf77a8d86000000000000000000000000000000000000000000000000000000000000000b5069786965205265616c6d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055049584945000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102a05760003560e01c806389fb4c6611610167578063c5ab3ba6116100ce578063dd62ed3e11610087578063dd62ed3e1461060a578063dd63769914610635578063dfabc03314610648578063e985e9c51461065b578063f2fde38b14610689578063f780bc1a1461069c57600080fd5b8063c5ab3ba6146105ae578063c6a6f41b146105b6578063c6e672b9146105be578063c87b56dd146105d1578063d505accf146105e4578063d96ca0b9146105f757600080fd5b8063a22cb46511610120578063a22cb46514610542578063a9059cbb14610555578063b1ab931714610568578063b3f9ea3414610588578063b88d4fde1461059b578063bc2ffd3b1461036d57600080fd5b806389fb4c66146104df5780638a696e50146104e75780638da5cb5b146104fa57806395d89b411461050b578063976a84351461051357806399d292a71461053a57600080fd5b8063388551341161020b5780636a4a0ead116101c45780636a4a0ead146104665780636cb3cac8146104795780636e8f624b1461048c57806370a0823114610497578063715018a6146104b75780637ecebe00146104bf57600080fd5b8063388551341461040757806342842e0e1461040f5780634d966072146104245780634f02c4201461043757806355f804b3146104405780636352211e1461045357600080fd5b806309f0ef651161025d57806309f0ef65146103755780630de667001461038857806318160ddd146103aa57806323b872dd146103b3578063313ce567146103c65780633644e515146103ff57600080fd5b806301ffc9a7146102a557806302519da3146102cd57806306fdde0314610304578063081812fc14610319578063095ea7b31461035a57806309674eb01461036d575b600080fd5b6102b86102b3366004612f84565b6106bc565b60405190151581526020015b60405180910390f35b6102f66102db366004612fb8565b6001600160a01b031660009081526007602052604090205490565b6040519081526020016102c4565b61030c6106f3565b6040516102c49190613023565b610342610327366004613036565b6009602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016102c4565b6102b861036836600461304f565b610781565b6102f66107ba565b6102b8610383366004612fb8565b6107e4565b61039b610396366004612fb8565b610816565b6040516102c4939291906130b8565b6102f660055481565b6102b86103c136600461312d565b610833565b6103ed7f000000000000000000000000000000000000000000000000000000000000001281565b60405160ff90911681526020016102c4565b6102f6610870565b6102f66108c6565b61042261041d36600461312d565b6108d2565b005b6102b861043236600461304f565b6108f2565b6102f660065481565b61042261044e3660046131f5565b61097f565b610342610461366004613036565b610993565b61042261047436600461323e565b6109fd565b6102f6610487366004613036565b610a0a565b6102f6600160ff1b81565b6102f66104a5366004612fb8565b60076020526000908152604090205481565b610422610a17565b6102f66104cd366004612fb8565b600e6020526000908152604090205481565b6005546102f6565b6104226104f53660046132db565b610a2b565b6000546001600160a01b0316610342565b61030c610a35565b6102f67f0000000000000000000000000000000000000000000000000de0b6b3a764000081565b6102b8610a42565b6104226105503660046132f6565b610a4e565b6102b861056336600461304f565b610ae1565b61057b610576366004612fb8565b610b15565b6040516102c49190613329565b6102f6610596366004612fb8565b610b22565b6104226105a936600461333c565b610b43565b6006546102f6565b6102f6610c31565b6104226105cc3660046132f6565b610c3d565b61030c6105df366004613036565b610c53565b6104226105f23660046133b8565b610d16565b6102b861060536600461312d565b610f59565b6102f661061836600461342b565b600860209081526000928352604080842090915290825290205481565b61042261064336600461312d565b611019565b61042261065636600461304f565b61117a565b6102b861066936600461342b565b600a60209081526000928352604080842090915290825290205460ff1681565b610422610697366004612fb8565b61123f565b6106af6106aa366004613455565b61127f565b6040516102c49190613477565b60006001600160e01b0319821663caf91ff560e01b14806106ed57506001600160e01b031982166301ffc9a760e01b145b92915050565b60038054610700906134bb565b80601f016020809104026020016040519081016040528092919081815260200182805461072c906134bb565b80156107795780601f1061074e57610100808354040283529160200191610779565b820191906000526020600020905b81548152906001019060200180831161075c57829003601f168201915b505050505081565b600061078c8261131c565b156107a05761079b838361117a565b6107b1565b6107aa83836108f2565b90506106ed565b50600192915050565b60006107df6001546001600160801b03808216600160801b9092048116919091031690565b905090565b60006001600160a01b03821615806106ed5750506001600160a01b03166000908152600d602052604090205460ff1690565b6060600081610826600c85611335565b9250925092509193909250565b600061083e8261131c565b156108535761084e848484611019565b610865565b61085e848484610f59565b9050610869565b5060015b9392505050565b60007f000000000000000000000000000000000000000000000000000000000000000146146108a1576107df611459565b507fdc213c585f036b4eed95b7e1394ad02965a9ffc8ff027bfd974bd09b603acd9b90565b60006107df60016114f3565b6108ed83838360405180602001604052806000815250610b43565b505050565b60006001600160a01b03831661091b57604051635461585f60e01b815260040160405180910390fd5b3360008181526008602090815260408083206001600160a01b03881680855290835292819020869055518581529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350600192915050565b61098761153d565b6109908161156a565b50565b6000818152600b60205260409020546001600160a01b03166109b48261131c565b6109d1576040516307ed98ed60e31b815260040160405180910390fd5b6001600160a01b0381166109f85760405163c5723b5160e01b815260040160405180910390fd5b919050565b6108ed600c848484611576565b60006106ed60018361176f565b610a1f61153d565b610a2960006117da565b565b610990338261182a565b60048054610700906134bb565b60006107df6001611899565b6001600160a01b038216610a755760405163ccea9e6f60e01b815260040160405180910390fd5b336000818152600a602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60006001600160a01b038316610b0a57604051634e46966960e11b815260040160405180910390fd5b6108693384846118b2565b60606106ed600c83611bd9565b6001600160a01b0381166000908152600c60205260408120600101546106ed565b610b4c8261131c565b610b69576040516307ed98ed60e31b815260040160405180910390fd5b610b74848484610833565b506001600160a01b0383163b15801590610c0d5750604051630a85bd0160e11b808252906001600160a01b0385169063150b7a0290610bbd9033908990889088906004016134f5565b6020604051808303816000875af1158015610bdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c009190613532565b6001600160e01b03191614155b15610c2b57604051633da6393160e01b815260040160405180910390fd5b50505050565b60006107df6001611d0f565b610c4561153d565b610c4f828261182a565b5050565b60606000600f8054610c64906134bb565b80601f0160208091040260200160405190810160405280929190818152602001828054610c90906134bb565b8015610cdd5780601f10610cb257610100808354040283529160200191610cdd565b820191906000526020600020905b815481529060010190602001808311610cc057829003601f168201915b5050505050905080610cee84611d67565b604051602001610cff92919061354f565b604051602081830303815290604052915050919050565b42841015610d37576040516305787bdf60e01b815260040160405180910390fd5b610d408561131c565b15610d5e576040516303e7c1bd60e31b815260040160405180910390fd5b6001600160a01b038616610d8557604051635461585f60e01b815260040160405180910390fd5b60006001610d91610870565b6001600160a01b038a81166000818152600e602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015610e9d573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381161580610ed25750876001600160a01b0316816001600160a01b031614155b15610ef057604051632057875960e21b815260040160405180910390fd5b6001600160a01b0390811660009081526008602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b60006001600160a01b038416610f8257604051636edaef2f60e11b815260040160405180910390fd5b6001600160a01b038316610fa957604051634e46966960e11b815260040160405180910390fd5b6001600160a01b0384166000908152600860209081526040808320338452909152902054600019811461100557610fe08382613594565b6001600160a01b03861660009081526008602090815260408083203384529091529020555b6110108585856118b2565b95945050505050565b6001600160a01b03831661104057604051636edaef2f60e11b815260040160405180910390fd5b6001600160a01b03821661106757604051634e46966960e11b815260040160405180910390fd5b6000818152600b60205260409020546001600160a01b038481169116146110a0576040516282b42960e81b815260040160405180910390fd5b336001600160a01b038416148015906110dd57506001600160a01b0383166000908152600a6020908152604080832033845290915290205460ff16155b801561110057506000818152600960205260409020546001600160a01b03163314155b1561111d576040516282b42960e81b815260040160405180910390fd5b611126826107e4565b1561114457604051635ce7539760e01b815260040160405180910390fd5b61116f83837f0000000000000000000000000000000000000000000000000de0b6b3a7640000611dfa565b6108ed838383611eb6565b6000818152600b60205260409020546001600160a01b03163381148015906111c657506001600160a01b0381166000908152600a6020908152604080832033845290915290205460ff16155b156111e3576040516282b42960e81b815260040160405180910390fd5b60008281526009602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b61124761153d565b6001600160a01b03811661127657604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610990816117da565b606060008267ffffffffffffffff81111561129c5761129c613169565b6040519080825280602002602001820160405280156112c5578160200160208202803683370190505b509050835b6112d484866135a7565b811015611314576112e660018261176f565b826112f18784613594565b81518110611301576113016135ba565b60209081029190910101526001016112ca565b509392505050565b6000600160ff1b821180156106ed575050600019141590565b6060600081816113458686611f6d565b6001600160a01b03871660009081526020898152604080832060028101805483518186028101860190945280845295975095508694600190910193919286929084015b828210156113cb576000848152602090819020604080518082019091529084015461ffff8082168352620100009091041681830152825260019092019101611388565b5050505092508080548060200260200160405190810160405280929190818152602001828054801561144457602002820191906000526020600020906000905b82829054906101000a900461ffff1661ffff168152602001906002019060208260010104928301926001038202915080841161140b5790505b50505050509050935093509350509250925092565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f600360405161148b91906135d0565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b60006114fe82611899565b1561151c576040516375e52f4f60e01b815260040160405180910390fd5b5080546001600160801b031660009081526001909101602052604090205490565b6000546001600160a01b03163314610a295760405163118cdaa760e01b815233600482015260240161126d565b600f610c4f8282613694565b336000806115848784611f6d565b6001600160a01b038516600090815260208a905260409020600101549193509150806115e85760405162461bcd60e51b81526020600482015260136024820152722737ba3434b733903a37903932b7b93232b91760691b604482015260640161126d565b8581146116375760405162461bcd60e51b815260206004820152601a60248201527f57726f6e67206c6973742073697a6520636f6d6d69747465642e000000000000604482015260640161126d565b6000806116788989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b9250611f99915050565b91509150600060108263ffffffff16901c90508461ffff168861ffff161415806116aa57508561ffff168161ffff1614155b156116bb576116bb8b88838b61222a565b60005b8351811015611761578381815181106116d9576116d96135ba565b60200260200101518c60000160008a6001600160a01b03166001600160a01b03168152602001908152602001600020600201828154811061171c5761171c6135ba565b6000918252602091829020835191018054939092015161ffff908116620100000263ffffffff199094169116179190911790558061175981613754565b9150506116be565b505050505050505050505050565b600061179383546001600160801b03808216600160801b9092048116919091031690565b82106117b25760405163580821e760e01b815260040160405180910390fd5b5081546001600160801b03908116820116600090815260018301602052604090205492915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0382166118515760405163a41e3d3f60e01b815260040160405180910390fd5b80156118655761186082612270565b61186e565b61186e82612299565b6001600160a01b03919091166000908152600d60205260409020805460ff1916911515919091179055565b54600160801b81046001600160801b0390811691161490565b6001600160a01b038381166000908152600760205260408082205492851682528120549091906118e3868686611dfa565b60006118ee876107e4565b905060006118fb876107e4565b90508180156119075750805b611bcb5781156119b057600061193d7f0000000000000000000000000000000000000000000000000de0b6b3a764000085613783565b6001600160a01b038916600090815260076020526040902054611981907f0000000000000000000000000000000000000000000000000de0b6b3a764000090613783565b61198b9190613594565b905060005b818110156119a9576119a189612311565b600101611990565b5050611bcb565b8015611a4c576001600160a01b0388166000908152600760205260408120546119fa907f0000000000000000000000000000000000000000000000000de0b6b3a764000090613783565b611a247f0000000000000000000000000000000000000000000000000de0b6b3a764000087613783565b611a2e9190613594565b905060005b818110156119a957611a448a6123e5565b600101611a33565b6000611a787f0000000000000000000000000000000000000000000000000de0b6b3a764000088613783565b905060005b81811015611aac576000611a92600c8c612479565b61ffff169050611aa38b8b83611eb6565b50600101611a7d565b50807f0000000000000000000000000000000000000000000000000de0b6b3a7640000611aee8b6001600160a01b031660009081526007602052604090205490565b611af89190613783565b611b227f0000000000000000000000000000000000000000000000000de0b6b3a764000088613783565b611b2c9190613594565b1115611b3b57611b3b896123e5565b80611b667f0000000000000000000000000000000000000000000000000de0b6b3a764000086613783565b7f0000000000000000000000000000000000000000000000000de0b6b3a7640000611ba68b6001600160a01b031660009081526007602052604090205490565b611bb09190613783565b611bba9190613594565b1115611bc957611bc988612311565b505b506001979650505050505050565b60606000611be784846124de565b6001600160a01b0384166000908152602086905260408120600101549192508167ffffffffffffffff811115611c1f57611c1f613169565b604051908082528060200260200182016040528015611c48578160200160208202803683370190505b50905060005b82811015611d05576001600160a01b0386166000908152602088905260409020600101805461ffff8616908110611c8757611c876135ba565b60009182526020909120601082040154600f9091166002026101000a900461ffff1682611cb58360016135a7565b611cbf9086613594565b81518110611ccf57611ccf6135ba565b61ffff90921660209283029190910190910152611ced8787866124f2565b60200151935080611cfd81613754565b915050611c4e565b5095945050505050565b6000611d1a82611899565b15611d38576040516375e52f4f60e01b815260040160405180910390fd5b5080546000196001600160801b03600160801b9092048216011660009081526001909101602052604090205490565b60606000611d748361256e565b600101905060008167ffffffffffffffff811115611d9457611d94613169565b6040519080825280601f01601f191660200182016040528015611dbe576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611dc857509392505050565b6001600160a01b038316611e25578060056000828254611e1a91906135a7565b90915550611e539050565b6001600160a01b03831660009081526007602052604081208054839290611e4d908490613594565b90915550505b6001600160a01b03808316600081815260076020526040908190208054850190555190918516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611ea99085815260200190565b60405180910390a3505050565b6001600160a01b03831615611eed57600081815260096020526040902080546001600160a01b0319169055611eed600c8483612646565b6001600160a01b03821615611f1757611f068183612bb1565b611f12600c8383612be0565b611f27565b6000818152600b60205260408120555b80826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6001600160a01b03166000908152602091909152604090206003015461ffff601082901c811692911690565b6060600080611fac855161ffff16612d7f565b905060008167ffffffffffffffff811115611fc957611fc9613169565b604051908082528060200260200182016040528015611ff2578160200160208202803683370190505b5090506000865167ffffffffffffffff81111561201157612011613169565b60405190808252806020026020018201604052801561205657816020015b604080518082019091526000808252602082015281526020019060019003908161202f5790505b509050600061ffff87168188815b60018c516120729190613594565b8110156121e057600061010061ffff80851691909104169050600088828151811061209f5761209f6135ba565b602002602001015190508d518461ffff16106120d4576040516319c3f23160e11b815261ffff8516600482015260240161126d565b6120de8185612d9e565b15612102576040516308c2ae1560e11b815261ffff8516600482015260240161126d565b61210c8185612dc2565b89838151811061211e5761211e6135ba565b6020908102919091010152821561215a5784888561ffff1681518110612146576121466135ba565b602090810291909101015161ffff90911690525b8d8461ffff1681518110612170576121706135ba565b6020026020010151888561ffff168151811061218e5761218e6135ba565b60200260200101516020019061ffff16908161ffff16815250508394508d8461ffff16815181106121c1576121c16135ba565b60200260200101519350505080806121d890613754565b915050612064565b5081858261ffff16815181106121f8576121f86135ba565b602090810291909101015161ffff919091169052939a60109490941b63ffff0000169091179850919650505050505050565b6001600160a01b0390921660009081526020939093526040909220600301805463ffffffff191661ffff9290921663ffff000060109490941b9390931692909217179055565b600061227b82610b22565b905060005b818110156108ed57612291836123e5565b600101612280565b6001600160a01b0381166000908152600760205260408120546122dd907f0000000000000000000000000000000000000000000000000de0b6b3a764000090613783565b905060006122ea83610b22565b905060005b6122f98284613594565b811015610c2b5761230984612311565b6001016122ef565b6001600160a01b03811661233857604051634e46966960e11b815260040160405180910390fd5b60006123446001611899565b612359576123526001612de5565b90506123a3565b60066000815461236890613754565b9091555060065460010161238f5760405163303b682f60e01b815260040160405180910390fd5b6006546123a090600160ff1b6135a7565b90505b6000818152600b60205260409020546001600160a01b031680156123da5760405163119b4fd360e11b815260040160405180910390fd5b6108ed818484611eb6565b6001600160a01b03811661240c57604051636edaef2f60e11b815260040160405180910390fd5b6000612419600c83612e55565b905061242a8161ffff166000612bb1565b612439600161ffff8316612e6e565b60405161ffff8216906000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6001600160a01b038116600090815260208390526040812060010161249e84846124de565b61ffff16815481106124b2576124b26135ba565b90600052602060002090601091828204019190066002029054906101000a900461ffff16905092915050565b60006124ea8383611f6d565b949350505050565b60408051808201909152600080825260208201526001600160a01b0383166000908152602085905260409020600201805461ffff8416908110612537576125376135ba565b60009182526020918290206040805180820190915291015461ffff8082168352620100009091041691810191909152949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106125ad5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106125d9576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106125f757662386f26fc10000830492506010015b6305f5e100831061260f576305f5e100830492506008015b612710831061262357612710830492506004015b60648310612635576064830492506002015b600a83106106ed5760010192915050565b6001600160a01b03821660009081526020848152604080832061ffff858116855292528220546126799160019116613797565b905060006126888585846124f2565b6001600160a01b03851660009081526020879052604090206002015490915060011015612ab4576000806126bc8787611f6d565b90925090506000806126ce8989612ee1565b915091508261ffff168661ffff16036126ed57846020015192506127b4565b8361ffff168661ffff160361270557845193506127b4565b84516020808701516001600160a01b038b166000908152918c90526040909120600201805483919061ffff8416908110612741576127416135ba565b6000918252602080832091909101805461ffff191661ffff9485161790556001600160a01b038d1682528d90526040902060020180548392851690811061278a5761278a6135ba565b9060005260206000200160000160026101000a81548161ffff021916908361ffff16021790555050505b8561ffff168161ffff1614612a9f5760006127d08a8a846124f2565b805160208201519192509061ffff80871690851603612844576001600160a01b038b16600090815260208d90526040902060020180548a975087919061ffff8416908110612820576128206135ba565b6000918252602090912001805461ffff191661ffff9290921691909117905561295b565b8661ffff168461ffff16036128b6576001600160a01b038b16600090815260208d90526040902060020180548a985088919061ffff851690811061288a5761288a6135ba565b9060005260206000200160000160026101000a81548161ffff021916908361ffff16021790555061295b565b6001600160a01b038b16600090815260208d90526040902060020180548a919061ffff84169081106128ea576128ea6135ba565b6000918252602080832091909101805461ffff191661ffff9485161790556001600160a01b038e1682528e90526040902060020180548b928516908110612933576129336135ba565b9060005260206000200160000160026101000a81548161ffff021916908361ffff1602179055505b82516001600160a01b038c16600090815260208e905260409020600201805461ffff8c1690811061298e5761298e6135ba565b6000918252602080832091909101805461ffff191661ffff948516179055858101516001600160a01b038f168352908f90526040909120600201805491929091908c169081106129e0576129e06135ba565b6000918252602090912001805461ffff92909216620100000263ffff000019909216919091179055612a138960016137b9565b6001600160a01b038c16600081815260208f8152604080832061ffff8b81168552818452918420805461ffff191696831696909617909555929091528e90526001909101805487928c16908110612a6c57612a6c6135ba565b90600052602060002090601091828204019190066002026101000a81548161ffff021916908361ffff1602179055505050505b612aab8989868661222a565b50505050612adb565b6001600160a01b0384166000908152602086905260409020600301805463ffffffff191690555b6001600160a01b0384166000908152602086905260409020600101805480612b0557612b056137d4565b60008281526020808220601060001994909401938404018054600f851660029081026101000a61ffff0219909116909155929093556001600160a01b038716815291879052604090912001805480612b5f57612b5f6137d4565b600082815260208082208301600019908101805463ffffffff191690559092019092556001600160a01b0390951681529484525050604080842061ffff92909216845291529020805461ffff19169055565b6000918252600b602052604090912080546001600160a01b0319166001600160a01b0392909216919091019055565b6001600160a01b0382166000908152602084905260408120600101549080612c088686611f6d565b6001600160a01b038716600090815260208981526040808320600190810180549182018155845282842060108204018054600f9092166002026101000a61ffff818102199093168c841691909102179055815180830190925292815283831691810191909152929450909250841615612cd55761ffff821660208083018290526001600160a01b0388166000908152908990526040902060020180548692908110612cb557612cb56135ba565b6000918252602090912001805461ffff191661ffff929092169190911790555b6001600160a01b03861660009081526020888152604082206002018054600181018255908352918190208351920180549184015161ffff908116620100000263ffffffff19909316931692909217179055612d328787858761222a565b612d3d8460016137b9565b6001600160a01b039690961660009081526020978852604080822061ffff978816835290985296909620805461ffff1916949095169390931790935550505050565b6000612d938261010061ffff918216041690565b6106ed9060016135a7565b600080612dad610100846137ea565b61ffff169390931c6001908116149392505050565b600080612dd1610100846137ea565b600161ffff9091161b841791505092915050565b80546000906001600160801b03600160801b8204811691168103612e1c576040516375e52f4f60e01b815260040160405180910390fd5b600019016001600160801b039081166000818152600185016020526040812080549190558454909216600160801b909102179092555090565b6000612e618383612479565b90506106ed838383612646565b81546001600160801b038082166000190191600160801b9004811690821603612eaa57604051638acb5f2760e01b815260040160405180910390fd5b6001600160801b0316600081815260018401602052604090209190915581546fffffffffffffffffffffffffffffffff1916179055565b6001600160a01b038116600090815260208390526040812060019081015482918291612f0d9190613594565b6001600160a01b038516600090815260208790526040902060010180549192509061ffff8316908110612f4257612f426135ba565b60009182526020909120601082040154600f9091166002026101000a900461ffff169590945092505050565b6001600160e01b03198116811461099057600080fd5b600060208284031215612f9657600080fd5b813561086981612f6e565b80356001600160a01b03811681146109f857600080fd5b600060208284031215612fca57600080fd5b61086982612fa1565b60005b83811015612fee578181015183820152602001612fd6565b50506000910152565b6000815180845261300f816020860160208601612fd3565b601f01601f19169290920160200192915050565b6020815260006108696020830184612ff7565b60006020828403121561304857600080fd5b5035919050565b6000806040838503121561306257600080fd5b61306b83612fa1565b946020939093013593505050565b600081518084526020808501945080840160005b838110156130ad57815161ffff168752958201959082019060010161308d565b509495945050505050565b606080825284519082018190526000906020906080840190828801845b82811015613104578151805161ffff9081168652908601511685850152604090930192908401906001016130d5565b50505061ffff86168285015283810360408501526131228186613079565b979650505050505050565b60008060006060848603121561314257600080fd5b61314b84612fa1565b925061315960208501612fa1565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff8084111561319a5761319a613169565b604051601f8501601f19908116603f011681019082821181831017156131c2576131c2613169565b816040528093508581528686860111156131db57600080fd5b858560208301376000602087830101525050509392505050565b60006020828403121561320757600080fd5b813567ffffffffffffffff81111561321e57600080fd5b8201601f8101841361322f57600080fd5b6124ea8482356020840161317f565b60008060006040848603121561325357600080fd5b833567ffffffffffffffff8082111561326b57600080fd5b818601915086601f83011261327f57600080fd5b81358181111561328e57600080fd5b8760208260051b85010111156132a357600080fd5b6020928301955093505084013561ffff811681146132c057600080fd5b809150509250925092565b803580151581146109f857600080fd5b6000602082840312156132ed57600080fd5b610869826132cb565b6000806040838503121561330957600080fd5b61331283612fa1565b9150613320602084016132cb565b90509250929050565b6020815260006108696020830184613079565b6000806000806080858703121561335257600080fd5b61335b85612fa1565b935061336960208601612fa1565b925060408501359150606085013567ffffffffffffffff81111561338c57600080fd5b8501601f8101871361339d57600080fd5b6133ac8782356020840161317f565b91505092959194509250565b600080600080600080600060e0888a0312156133d357600080fd5b6133dc88612fa1565b96506133ea60208901612fa1565b95506040880135945060608801359350608088013560ff8116811461340e57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561343e57600080fd5b61344783612fa1565b915061332060208401612fa1565b6000806040838503121561346857600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b818110156134af57835183529284019291840191600101613493565b50909695505050505050565b600181811c908216806134cf57607f821691505b6020821081036134ef57634e487b7160e01b600052602260045260246000fd5b50919050565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061352890830184612ff7565b9695505050505050565b60006020828403121561354457600080fd5b815161086981612f6e565b60008351613561818460208801612fd3565b835190830190613575818360208801612fd3565b01949350505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106ed576106ed61357e565b808201808211156106ed576106ed61357e565b634e487b7160e01b600052603260045260246000fd5b60008083546135de816134bb565b600182811680156135f6576001811461360b5761363a565b60ff198416875282151583028701945061363a565b8760005260208060002060005b858110156136315781548a820152908401908201613618565b50505082870194505b50929695505050505050565b601f8211156108ed57600081815260208120601f850160051c8101602086101561366d5750805b601f850160051c820191505b8181101561368c57828155600101613679565b505050505050565b815167ffffffffffffffff8111156136ae576136ae613169565b6136c2816136bc84546134bb565b84613646565b602080601f8311600181146136f757600084156136df5750858301515b600019600386901b1c1916600185901b17855561368c565b600085815260208120601f198616915b8281101561372657888601518255948401946001909101908401613707565b50858210156137445787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000600182016137665761376661357e565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826137925761379261376d565b500490565b61ffff8281168282160390808211156137b2576137b261357e565b5092915050565b61ffff8181168382160190808211156137b2576137b261357e565b634e487b7160e01b600052603160045260246000fd5b600061ffff808416806137ff576137ff61376d565b9216919091069291505056fea2646970667358221220feaad0b6b48416c3e69b7054ab8290ade0903ba9cab25224307e5d796e22d3d064736f6c63430008140033

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

000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000d978631f3e9469df439e7c311f5551f2d94c072000000000000000000000000f9211b7e2285cfb2acae6693fc465fdcf77a8d86000000000000000000000000000000000000000000000000000000000000000b5069786965205265616c6d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000055049584945000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : name_ (string): Pixie Realm
Arg [1] : symbol_ (string): PIXIE
Arg [2] : minter_ (address): 0x0D978631f3E9469DF439E7C311f5551f2d94c072
Arg [3] : initialOwner_ (address): 0xf9211b7E2285cfB2ACaE6693fC465fDcF77a8D86

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000000d978631f3e9469df439e7c311f5551f2d94c072
Arg [3] : 000000000000000000000000f9211b7e2285cfb2acae6693fc465fdcf77a8d86
Arg [4] : 000000000000000000000000000000000000000000000000000000000000000b
Arg [5] : 5069786965205265616c6d000000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [7] : 5049584945000000000000000000000000000000000000000000000000000000


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.