ETH Price: $3,224.81 (-0.93%)
Gas: 33 Gwei

Token

EnigmaMiningFactionsTwo (EMF2)
 

Overview

Max Total Supply

1,894 EMF2

Holders

120

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Balance
4 EMF2
0x12E384B1B904eFA8F35c66535D35Fe64149e3810
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:
EnigmaMiningFactionsTwo

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 11 : EnigmaMiningFactionsTwo.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "./ERC721A.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";

// import "hardhat/console.sol";

contract EnigmaMiningFactionsTwo is Ownable, ERC721A {
    // Interface imports
    AggregatorV3Interface internal priceFeed; // Chainlink Aggregator for USD-ETH conversion

    // Variable Declaration
    uint256 public MAX_NFTS = 4000;

    uint256 public MAX_MINT = 25;

    uint256 public presaleMintedCounter = 0;
    uint256 public publicMintedCounter = 0;

    uint256 public presaleReservedCounter = 0;

    uint256 public acceptedChangePercentage = 2;
    uint256 public mintPrice = 250; // 250 USD for each NFT
    uint256 public presaleMintPrice = 0; // 0 USD for each NFT already paid for

    bool public presaleMintActive = false;
    bool public publicMintActive = false;

    uint256 public startTime = 1677981600;

    enum TokenType {
        ETH,
        USDC
    }

    struct Whitelist {
        address addr;
        uint256 count;
    }

    string private _baseTokenURI = "";

    modifier noContracts() {
        require(msg.sender == tx.origin);
        _;
    }
    IERC20 public USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);

    mapping(address => uint256) public presaleReservations;

    // constructor
    constructor() ERC721A("EnigmaMiningFactionsTwo", "EMF2") {
        priceFeed = AggregatorV3Interface(
            // Goerli : 0xD4a33860578De61DBAbDc8BFdb98FD742fA7028e
            // Mainnet : 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
            0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
        );
    }

    // Public Functions

    /**
     * Returns the latest price based on inputted USD amount.
     */
    function getPriceRate(uint256 _amount) public view returns (uint256) {
        // prettier-ignore
        (, int256 price, , , ) = priceFeed.latestRoundData();
        uint256 adjust_price = uint256(price) * 1e10;
        uint256 usd = _amount * 1e18;
        uint256 rate = (usd * 1e18) / adjust_price;
        return rate;
    }

    /*
     * Returns the reservation amount left for each wallet
     */
    function getReservationCount(address _reservationAddress)
        public
        view
        returns (uint256)
    {
        return presaleReservations[_reservationAddress];
    }

    /**
     * Public Mint function
     * tokenType = 0 (Ethereum), 1 (USDC)
     */
    function publicMint(uint256 _mints, TokenType _tokenType)
        external
        payable
        noContracts
    {
        require(
            startTime != 0 && startTime <= block.timestamp,
            "Sale is not open"
        );
        require(
            publicMintActive == true,
            "Error: Public mint isn't active or has ended"
        );
        require(_mints <= MAX_MINT, "Error: Exceeds Max per TXN");
        require(
            totalSupply() + _mints + presaleReservedCounter <= MAX_NFTS,
            "Error: Exceeds Max Allocation"
        );
        
        uint256 _mintPrice = _mints * mintPrice;
        if (_tokenType == TokenType.ETH) {
            uint256 transactionPrice = getPriceRate(_mintPrice);
            uint256 priceFloor = (transactionPrice *
                (100 - acceptedChangePercentage)) / 100;
            uint256 priceCeil = (transactionPrice *
                (100 + acceptedChangePercentage)) / 100;
            require(
                msg.value >= priceFloor && msg.value <= priceCeil,
                "FD: Insufficient funds"
            );
            _mint(msg.sender, _mints);
            publicMintedCounter += _mints;
        } else {
            IERC20 token;
            if (_tokenType == TokenType.USDC) {
                token = USDC;

                // Would need to provide allowance before the transfer happens. Frontend will have to chain the two calls.
                require(
                    token.allowance(msg.sender, address(this)) >= _mintPrice,
                    "Error: Not enough allowance"
                );
                token.transferFrom(
                    msg.sender,
                    address(this),
                    _mintPrice * (10**6)
                );
                _mint(msg.sender, _mints);
                publicMintedCounter += _mints;
            }
        }
    }

    /**
     * Presale mint function to mint for already paid mints
     */
    function presaleMint(uint256 _mints)
        external
        payable
        noContracts
    {
        require(
            startTime != 0 && startTime <= block.timestamp,
            "Sale is not open"
        );
        uint256 availableMints = presaleReservations[msg.sender];
        require(availableMints > 0, "Error: No reservations found");
        require(availableMints >= _mints, "Error: Not enough reservations");
        require(_mints > 0, "Error: Invalid value");
        require(
            presaleMintActive == true,
            "Error: Presale Mint isn't active or has ended"
        );
        require(_mints <= MAX_MINT, "Error: Exceeds Max per TXN");
        require(
            totalSupply() + _mints <= MAX_NFTS,
            "Error: Exceeds Max Allocation"
        );
        presaleReservations[msg.sender] -= _mints;
        _mint(msg.sender, _mints);
        presaleMintedCounter += _mints;
        presaleReservedCounter -= _mints;
    }

    // Owner/Internal Functions

    /**
     * Whitelist for presale function
     * Adds address and count to whitelist presale
    */
    function whitelistForPresale(Whitelist[] memory users) external onlyOwner {
        for (uint i = 0; i < users.length; i++) {
            if (presaleReservations[users[i].addr] > 0) {
                presaleReservations[users[i].addr] += users[i].count;
            } else {
                presaleReservations[users[i].addr] = users[i].count;
            }
            
            presaleReservedCounter += users[i].count;
        }
    }

    /**
     * Set reserved count for a particular address 
    */
    function setReservedCountForAddress(address _address, uint256 _count) external onlyOwner {
        if (presaleReservations[_address] > 0) {
            if (presaleReservations[_address] > _count) {
                presaleReservedCounter -= (presaleReservations[_address] - _count);
            } else {
                presaleReservedCounter += (_count - presaleReservations[_address]);
            }
        } 
        presaleReservations[_address] = _count;
    }

    /**
     * Set base URI
     */
    function setBaseURI(string calldata baseURI) external onlyOwner {
        _baseTokenURI = baseURI;
    }

    /**
     * Treasury mint
     */
    function treasuryMint(uint256 _quantity, address _address)
        external
        onlyOwner
    {
        require(
            totalSupply() + _quantity <= MAX_NFTS,
            "Error: Cannot mint more than total supply"
        );
        _mint(_address, _quantity);
        publicMintedCounter += _quantity;
    }

    /**
     * Change mint price
     */
    function setSalePrice(uint256 _newMintPrice) external onlyOwner {
        mintPrice = _newMintPrice;
    }

    /**
     * Change pre-salemint price
     */
    function setPresalePrice(uint256 _newMintPrice) external onlyOwner {
        presaleMintPrice = _newMintPrice;
    }

    /**
     * Withdraw contract balances
     */
    function withdrawAll(address _wallet) external onlyOwner {
        uint256 balance = address(this).balance;
        payable(_wallet).transfer(balance);
        if (USDC.balanceOf(address(this)) > 0) {
            USDC.transfer(_wallet, USDC.balanceOf(address(this)));
        }
    }

    /**
     * Change USD-ETH conversion acceptance %
     */
    function setAcceptedChangePercentage(uint256 _newPercentage)
        external
        onlyOwner
    {
        require(_newPercentage > 0, "Error: Can't be 0");
        require(
            _newPercentage != acceptedChangePercentage,
            "Error: Same value as before"
        );
        acceptedChangePercentage = _newPercentage;
    }

    function setPresaleMintStatus(bool _newStatus) external onlyOwner {
        presaleMintActive = _newStatus;
    }

    function setPublicMintStatus(bool _newStatus) external onlyOwner {
        publicMintActive = _newStatus;
    }

    function setMaxNfts(uint256 maxNfts) external onlyOwner {
        MAX_NFTS = maxNfts;
    }

    function setMaxMints(uint256 maxMints) external onlyOwner {
        MAX_MINT = maxMints;
    }

    function setStartTime(uint256 _startTime) external onlyOwner {
        startTime = _startTime;
    }

    function setPresaleMintedCounter(uint256 _presaleMintedCounter)
        external
        onlyOwner
    {
        presaleMintedCounter = _presaleMintedCounter;
    }

    function setPublicMintedCounter(uint256 _publicMintedCounter)
        external
        onlyOwner
    {
        publicMintedCounter = _publicMintedCounter;
    }

    function setPresaleReservedCounter(uint256 _presaleReservedCounter) external onlyOwner {
        presaleReservedCounter = _presaleReservedCounter;
    }

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

File 2 of 11 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    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.
     *
     * _Available since v3.4._
     */
    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.
     *
     * _Available since v3.4._
     */
    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.
     *
     * _Available since v3.4._
     */
    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.
     *
     * _Available since v3.4._
     */
    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 addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 3 of 11 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 4 of 11 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

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

  function version() external view returns (uint256);

  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
}

File 5 of 11 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../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.
 *
 * By default, the owner account will be the one that deploys the contract. 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;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @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 {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @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 {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _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 6 of 11 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = 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), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(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) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

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

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

File 7 of 11 : ERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721A.sol';

/**
 * @dev ERC721 token receiver interface.
 */
interface ERC721A__IERC721Receiver {
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard,
 * including the Metadata extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at `_startTokenId()`
 * (defaults to 0, e.g. 0, 1, 2, 3..).
 *
 * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 *
 * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721A is IERC721A {
    // Mask of an entry in packed address data.
    uint256 private constant BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;

    // The bit position of `numberMinted` in packed address data.
    uint256 private constant BITPOS_NUMBER_MINTED = 64;

    // The bit position of `numberBurned` in packed address data.
    uint256 private constant BITPOS_NUMBER_BURNED = 128;

    // The bit position of `aux` in packed address data.
    uint256 private constant BITPOS_AUX = 192;

    // Mask of all 256 bits in packed address data except the 64 bits for `aux`.
    uint256 private constant BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;

    // The bit position of `startTimestamp` in packed ownership.
    uint256 private constant BITPOS_START_TIMESTAMP = 160;

    // The bit mask of the `burned` bit in packed ownership.
    uint256 private constant BITMASK_BURNED = 1 << 224;

    // The bit position of the `nextInitialized` bit in packed ownership.
    uint256 private constant BITPOS_NEXT_INITIALIZED = 225;

    // The bit mask of the `nextInitialized` bit in packed ownership.
    uint256 private constant BITMASK_NEXT_INITIALIZED = 1 << 225;

    // The bit position of `extraData` in packed ownership.
    uint256 private constant BITPOS_EXTRA_DATA = 232;

    // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
    uint256 private constant BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;

    // The mask of the lower 160 bits for addresses.
    uint256 private constant BITMASK_ADDRESS = (1 << 160) - 1;

    // The maximum `quantity` that can be minted with `_mintERC2309`.
    // This limit is to prevent overflows on the address data entries.
    // For a limit of 5000, a total of 3.689e15 calls to `_mintERC2309`
    // is required to cause an overflow, which is unrealistic.
    uint256 private constant MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;

    // The tokenId of the next token to be minted.
    uint256 private _currentIndex;

    // The number of tokens burned.
    uint256 private _burnCounter;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to ownership details
    // An empty struct value does not necessarily mean the token is unowned.
    // See `_packedOwnershipOf` implementation for details.
    //
    // Bits Layout:
    // - [0..159]   `addr`
    // - [160..223] `startTimestamp`
    // - [224]      `burned`
    // - [225]      `nextInitialized`
    // - [232..255] `extraData`
    mapping(uint256 => uint256) private _packedOwnerships;

    // Mapping owner address to address data.
    //
    // Bits Layout:
    // - [0..63]    `balance`
    // - [64..127]  `numberMinted`
    // - [128..191] `numberBurned`
    // - [192..255] `aux`
    mapping(address => uint256) private _packedAddressData;

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

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

    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
        _currentIndex = _startTokenId();
    }

    /**
     * @dev Returns the starting token ID.
     * To change the starting token ID, please override this function.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev Returns the next token ID to be minted.
     */
    function _nextTokenId() internal view returns (uint256) {
        return _currentIndex;
    }

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see `_totalMinted`.
     */
    function totalSupply() public view override returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than `_currentIndex - _startTokenId()` times.
        unchecked {
            return _currentIndex - _burnCounter - _startTokenId();
        }
    }

    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view returns (uint256) {
        // Counter underflow is impossible as _currentIndex does not decrement,
        // and it is initialized to `_startTokenId()`
        unchecked {
            return _currentIndex - _startTokenId();
        }
    }

    /**
     * @dev Returns the total number of tokens burned.
     */
    function _totalBurned() internal view returns (uint256) {
        return _burnCounter;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        // The interface IDs are constants representing the first 4 bytes of the XOR of
        // all function selectors in the interface. See: https://eips.ethereum.org/EIPS/eip-165
        // e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`
        return
            interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
            interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
            interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view override returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return _packedAddressData[owner] & BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return (_packedAddressData[owner] >> BITPOS_NUMBER_MINTED) & BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens burned by or on behalf of `owner`.
     */
    function _numberBurned(address owner) internal view returns (uint256) {
        return (_packedAddressData[owner] >> BITPOS_NUMBER_BURNED) & BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     */
    function _getAux(address owner) internal view returns (uint64) {
        return uint64(_packedAddressData[owner] >> BITPOS_AUX);
    }

    /**
     * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
     * If there are multiple variables, please pack them into a uint64.
     */
    function _setAux(address owner, uint64 aux) internal {
        uint256 packed = _packedAddressData[owner];
        uint256 auxCasted;
        // Cast `aux` with assembly to avoid redundant masking.
        assembly {
            auxCasted := aux
        }
        packed = (packed & BITMASK_AUX_COMPLEMENT) | (auxCasted << BITPOS_AUX);
        _packedAddressData[owner] = packed;
    }

    /**
     * Returns the packed ownership data of `tokenId`.
     */
    function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
        uint256 curr = tokenId;

        unchecked {
            if (_startTokenId() <= curr)
                if (curr < _currentIndex) {
                    uint256 packed = _packedOwnerships[curr];
                    // If not burned.
                    if (packed & BITMASK_BURNED == 0) {
                        // Invariant:
                        // There will always be an ownership that has an address and is not burned
                        // before an ownership that does not have an address and is not burned.
                        // Hence, curr will not underflow.
                        //
                        // We can directly compare the packed value.
                        // If the address is zero, packed is zero.
                        while (packed == 0) {
                            packed = _packedOwnerships[--curr];
                        }
                        return packed;
                    }
                }
        }
        revert OwnerQueryForNonexistentToken();
    }

    /**
     * Returns the unpacked `TokenOwnership` struct from `packed`.
     */
    function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
        ownership.addr = address(uint160(packed));
        ownership.startTimestamp = uint64(packed >> BITPOS_START_TIMESTAMP);
        ownership.burned = packed & BITMASK_BURNED != 0;
        ownership.extraData = uint24(packed >> BITPOS_EXTRA_DATA);
    }

    /**
     * Returns the unpacked `TokenOwnership` struct at `index`.
     */
    function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnerships[index]);
    }

    /**
     * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
     */
    function _initializeOwnershipAt(uint256 index) internal {
        if (_packedOwnerships[index] == 0) {
            _packedOwnerships[index] = _packedOwnershipOf(index);
        }
    }

    /**
     * Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around in the collection over time.
     */
    function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnershipOf(tokenId));
    }

    /**
     * @dev Packs ownership data into a single uint256.
     */
    function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
        assembly {
            // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
            owner := and(owner, BITMASK_ADDRESS)
            // `owner | (block.timestamp << BITPOS_START_TIMESTAMP) | flags`.
            result := or(owner, or(shl(BITPOS_START_TIMESTAMP, timestamp()), flags))
        }
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return address(uint160(_packedOwnershipOf(tokenId)));
    }

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

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

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

        string memory baseURI = _baseURI();
        return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
    }

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

    /**
     * @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
     */
    function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
        // For branchless setting of the `nextInitialized` flag.
        assembly {
            // `(quantity == 1) << BITPOS_NEXT_INITIALIZED`.
            result := shl(BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
        }
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public override {
        address owner = ownerOf(tokenId);

        if (_msgSenderERC721A() != owner)
            if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                revert ApprovalCallerNotOwnerNorApproved();
            }

        _tokenApprovals[tokenId] = to;
        emit Approval(owner, to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        if (operator == _msgSenderERC721A()) revert ApproveToCaller();

        _operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

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

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return
            _startTokenId() <= tokenId &&
            tokenId < _currentIndex && // If within bounds,
            _packedOwnerships[tokenId] & BITMASK_BURNED == 0; // and not burned.
    }

    /**
     * @dev Equivalent to `_safeMint(to, quantity, '')`.
     */
    function _safeMint(address to, uint256 quantity) internal {
        _safeMint(to, quantity, '');
    }

    /**
     * @dev Safely mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement
     *   {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
     * - `quantity` must be greater than 0.
     *
     * See {_mint}.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _safeMint(
        address to,
        uint256 quantity,
        bytes memory _data
    ) internal {
        _mint(to, quantity);

        unchecked {
            if (to.code.length != 0) {
                uint256 end = _currentIndex;
                uint256 index = end - quantity;
                do {
                    if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (index < end);
                // Reentrancy protection.
                if (_currentIndex != end) revert();
            }
        }
    }

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {Transfer} event for each mint.
     */
    function _mint(address to, uint256 quantity) internal {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are incredibly unrealistic.
        // `balance` and `numberMinted` have a maximum limit of 2**64.
        // `tokenId` has a maximum limit of 2**256.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            _packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            uint256 tokenId = startTokenId;
            uint256 end = startTokenId + quantity;
            do {
                emit Transfer(address(0), to, tokenId++);
            } while (tokenId < end);

            _currentIndex = end;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Mints `quantity` tokens and transfers them to `to`.
     *
     * This function is intended for efficient minting only during contract creation.
     *
     * It emits only one {ConsecutiveTransfer} as defined in
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
     * instead of a sequence of {Transfer} event(s).
     *
     * Calling this function outside of contract creation WILL make your contract
     * non-compliant with the ERC721 standard.
     * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
     * {ConsecutiveTransfer} event is only permissible during contract creation.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `quantity` must be greater than 0.
     *
     * Emits a {ConsecutiveTransfer} event.
     */
    function _mintERC2309(address to, uint256 quantity) internal {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        if (quantity == 0) revert MintZeroQuantity();
        if (quantity > MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();

        _beforeTokenTransfers(address(0), to, startTokenId, quantity);

        // Overflows are unrealistic due to the above check for `quantity` to be below the limit.
        unchecked {
            // Updates:
            // - `balance += quantity`.
            // - `numberMinted += quantity`.
            //
            // We can directly add to the `balance` and `numberMinted`.
            _packedAddressData[to] += quantity * ((1 << BITPOS_NUMBER_MINTED) | 1);

            // Updates:
            // - `address` to the owner.
            // - `startTimestamp` to the timestamp of minting.
            // - `burned` to `false`.
            // - `nextInitialized` to `quantity == 1`.
            _packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);

            _currentIndex = startTokenId + quantity;
        }
        _afterTokenTransfers(address(0), to, startTokenId, quantity);
    }

    /**
     * @dev Returns the storage slot and value for the approved address of `tokenId`.
     */
    function _getApprovedAddress(uint256 tokenId)
        private
        view
        returns (uint256 approvedAddressSlot, address approvedAddress)
    {
        mapping(uint256 => address) storage tokenApprovalsPtr = _tokenApprovals;
        // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`.
        assembly {
            // Compute the slot.
            mstore(0x00, tokenId)
            mstore(0x20, tokenApprovalsPtr.slot)
            approvedAddressSlot := keccak256(0x00, 0x40)
            // Load the slot's value from storage.
            approvedAddress := sload(approvedAddressSlot)
        }
    }

    /**
     * @dev Returns whether the `approvedAddress` is equals to `from` or `msgSender`.
     */
    function _isOwnerOrApproved(
        address approvedAddress,
        address from,
        address msgSender
    ) private pure returns (bool result) {
        assembly {
            // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
            from := and(from, BITMASK_ADDRESS)
            // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
            msgSender := and(msgSender, BITMASK_ADDRESS)
            // `msgSender == from || msgSender == approvedAddress`.
            result := or(eq(msgSender, from), eq(msgSender, approvedAddress))
        }
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

        if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedAddress(tokenId);

        // The nested ifs save around 20+ gas over a compound boolean condition.
        if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A()))
            if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();

        if (to == address(0)) revert TransferToZeroAddress();

        _beforeTokenTransfers(from, to, tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as tokenId would have to be 2**256.
        unchecked {
            // We can directly increment and decrement the balances.
            --_packedAddressData[from]; // Updates: `balance -= 1`.
            ++_packedAddressData[to]; // Updates: `balance += 1`.

            // Updates:
            // - `address` to the next owner.
            // - `startTimestamp` to the timestamp of transfering.
            // - `burned` to `false`.
            // - `nextInitialized` to `true`.
            _packedOwnerships[tokenId] = _packOwnershipData(
                to,
                BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (_packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != _currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        emit Transfer(from, to, tokenId);
        _afterTokenTransfers(from, to, tokenId, 1);
    }

    /**
     * @dev Equivalent to `_burn(tokenId, false)`.
     */
    function _burn(uint256 tokenId) internal virtual {
        _burn(tokenId, false);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

        address from = address(uint160(prevOwnershipPacked));

        (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedAddress(tokenId);

        if (approvalCheck) {
            // The nested ifs save around 20+ gas over a compound boolean condition.
            if (!_isOwnerOrApproved(approvedAddress, from, _msgSenderERC721A()))
                if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
        }

        _beforeTokenTransfers(from, address(0), tokenId, 1);

        // Clear approvals from the previous owner.
        assembly {
            if approvedAddress {
                // This is equivalent to `delete _tokenApprovals[tokenId]`.
                sstore(approvedAddressSlot, 0)
            }
        }

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
        unchecked {
            // Updates:
            // - `balance -= 1`.
            // - `numberBurned += 1`.
            //
            // We can directly decrement the balance, and increment the number burned.
            // This is equivalent to `packed -= 1; packed += 1 << BITPOS_NUMBER_BURNED;`.
            _packedAddressData[from] += (1 << BITPOS_NUMBER_BURNED) - 1;

            // Updates:
            // - `address` to the last owner.
            // - `startTimestamp` to the timestamp of burning.
            // - `burned` to `true`.
            // - `nextInitialized` to `true`.
            _packedOwnerships[tokenId] = _packOwnershipData(
                from,
                (BITMASK_BURNED | BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
            );

            // If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
            if (prevOwnershipPacked & BITMASK_NEXT_INITIALIZED == 0) {
                uint256 nextTokenId = tokenId + 1;
                // If the next slot's address is zero and not burned (i.e. packed value is zero).
                if (_packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != _currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        _packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

        emit Transfer(from, address(0), tokenId);
        _afterTokenTransfers(from, address(0), tokenId, 1);

        // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
        unchecked {
            _burnCounter++;
        }
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkContractOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
            bytes4 retval
        ) {
            return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                revert TransferToNonERC721ReceiverImplementer();
            } else {
                assembly {
                    revert(add(32, reason), mload(reason))
                }
            }
        }
    }

    /**
     * @dev Directly sets the extra data for the ownership data `index`.
     */
    function _setExtraDataAt(uint256 index, uint24 extraData) internal {
        uint256 packed = _packedOwnerships[index];
        if (packed == 0) revert OwnershipNotInitializedForExtraData();
        uint256 extraDataCasted;
        // Cast `extraData` with assembly to avoid redundant masking.
        assembly {
            extraDataCasted := extraData
        }
        packed = (packed & BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << BITPOS_EXTRA_DATA);
        _packedOwnerships[index] = packed;
    }

    /**
     * @dev Returns the next extra data for the packed ownership data.
     * The returned result is shifted into position.
     */
    function _nextExtraData(
        address from,
        address to,
        uint256 prevOwnershipPacked
    ) private view returns (uint256) {
        uint24 extraData = uint24(prevOwnershipPacked >> BITPOS_EXTRA_DATA);
        return uint256(_extraData(from, to, extraData)) << BITPOS_EXTRA_DATA;
    }

    /**
     * @dev Called during each token transfer to set the 24bit `extraData` field.
     * Intended to be overridden by the cosumer contract.
     *
     * `previousExtraData` - the value of `extraData` before transfer.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _extraData(
        address from,
        address to,
        uint24 previousExtraData
    ) internal view virtual returns (uint24) {}

    /**
     * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred.
     * This includes minting.
     * And also called before burning one token.
     *
     * startTokenId - the first token id to be transferred
     * quantity - the amount to be transferred
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, `tokenId` will be burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _beforeTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Hook that is called after a set of serially-ordered token ids have been transferred.
     * This includes minting.
     * And also called after one token has been burned.
     *
     * startTokenId - the first token id to be transferred
     * quantity - the amount to be transferred
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
     * transferred to `to`.
     * - When `from` is zero, `tokenId` has been minted for `to`.
     * - When `to` is zero, `tokenId` has been burned by `from`.
     * - `from` and `to` are never both zero.
     */
    function _afterTokenTransfers(
        address from,
        address to,
        uint256 startTokenId,
        uint256 quantity
    ) internal virtual {}

    /**
     * @dev Returns the message sender (defaults to `msg.sender`).
     *
     * If you are writing GSN compatible contracts, you need to override this function.
     */
    function _msgSenderERC721A() internal view virtual returns (address) {
        return msg.sender;
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function _toString(uint256 value) internal pure returns (string memory ptr) {
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit),
            // but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged.
            // We will need 1 32-byte word to store the length,
            // and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128.
            ptr := add(mload(0x40), 128)
            // Update the free memory pointer to allocate.
            mstore(0x40, ptr)

            // Cache the end of the memory to calculate the length later.
            let end := ptr

            // We write the string from the rightmost digit to the leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            // Costs a bit more than early returning for the zero case,
            // but cheaper in terms of deployment and overall runtime costs.
            for {
                // Initialize and perform the first pass without check.
                let temp := value
                // Move the pointer 1 byte leftwards to point to an empty character slot.
                ptr := sub(ptr, 1)
                // Write the character to the pointer. 48 is the ASCII index of '0'.
                mstore8(ptr, add(48, mod(temp, 10)))
                temp := div(temp, 10)
            } temp {
                // Keep dividing `temp` until zero.
                temp := div(temp, 10)
            } {
                // Body of the for loop.
                ptr := sub(ptr, 1)
                mstore8(ptr, add(48, mod(temp, 10)))
            }

            let length := sub(end, ptr)
            // Move the pointer 32 bytes leftwards to make room for the length.
            ptr := sub(ptr, 32)
            // Store the length.
            mstore(ptr, length)
        }
    }
}

File 8 of 11 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

/**
 * @dev Interface of an ERC721A compliant contract.
 */
interface IERC721A {
    /**
     * The caller must own the token or be an approved operator.
     */
    error ApprovalCallerNotOwnerNorApproved();

    /**
     * The token does not exist.
     */
    error ApprovalQueryForNonexistentToken();

    /**
     * The caller cannot approve to their own address.
     */
    error ApproveToCaller();

    /**
     * Cannot query the balance for the zero address.
     */
    error BalanceQueryForZeroAddress();

    /**
     * Cannot mint to the zero address.
     */
    error MintToZeroAddress();

    /**
     * The quantity of tokens minted must be more than zero.
     */
    error MintZeroQuantity();

    /**
     * The token does not exist.
     */
    error OwnerQueryForNonexistentToken();

    /**
     * The caller must own the token or be an approved operator.
     */
    error TransferCallerNotOwnerNorApproved();

    /**
     * The token must be owned by `from`.
     */
    error TransferFromIncorrectOwner();

    /**
     * Cannot safely transfer to a contract that does not implement the ERC721Receiver interface.
     */
    error TransferToNonERC721ReceiverImplementer();

    /**
     * Cannot transfer to the zero address.
     */
    error TransferToZeroAddress();

    /**
     * The token does not exist.
     */
    error URIQueryForNonexistentToken();

    /**
     * The `quantity` minted with ERC2309 exceeds the safety limit.
     */
    error MintERC2309QuantityExceedsLimit();

    /**
     * The `extraData` cannot be set on an unintialized ownership slot.
     */
    error OwnershipNotInitializedForExtraData();

    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Keeps track of the start time of ownership with minimal overhead for tokenomics.
        uint64 startTimestamp;
        // Whether the token has been burned.
        bool burned;
        // Arbitrary data similar to `startTimestamp` that can be set through `_extraData`.
        uint24 extraData;
    }

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     *
     * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
     */
    function totalSupply() external view returns (uint256);

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

    // ==============================
    //            IERC721
    // ==============================

    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(
        address indexed from,
        address indexed to,
        uint256 indexed tokenId
    );

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

    // ==============================
    //        IERC721Metadata
    // ==============================

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

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

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

    // ==============================
    //            IERC2309
    // ==============================

    /**
     * @dev Emitted when tokens in `fromTokenId` to `toTokenId` (inclusive) is transferred from `from` to `to`,
     * as defined in the ERC2309 standard. See `_mintERC2309` for more details.
     */
    event ConsecutiveTransfer(
        uint256 indexed fromTokenId,
        uint256 toTokenId,
        address indexed from,
        address indexed to
    );
}

File 9 of 11 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library 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 10 of 11 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

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

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

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

pragma solidity ^0.8.0;

/**
 * @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;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","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":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_MINT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_NFTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDC","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptedChangePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"getPriceRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_reservationAddress","type":"address"}],"name":"getReservationCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mints","type":"uint256"}],"name":"presaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"presaleMintActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleMintedCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"presaleReservations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleReservedCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mints","type":"uint256"},{"internalType":"enum EnigmaMiningFactionsTwo.TokenType","name":"_tokenType","type":"uint8"}],"name":"publicMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicMintActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicMintedCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newPercentage","type":"uint256"}],"name":"setAcceptedChangePercentage","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":"uint256","name":"maxMints","type":"uint256"}],"name":"setMaxMints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"maxNfts","type":"uint256"}],"name":"setMaxNfts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_newStatus","type":"bool"}],"name":"setPresaleMintStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_presaleMintedCounter","type":"uint256"}],"name":"setPresaleMintedCounter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newMintPrice","type":"uint256"}],"name":"setPresalePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_presaleReservedCounter","type":"uint256"}],"name":"setPresaleReservedCounter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_newStatus","type":"bool"}],"name":"setPublicMintStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_publicMintedCounter","type":"uint256"}],"name":"setPublicMintedCounter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"uint256","name":"_count","type":"uint256"}],"name":"setReservedCountForAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newMintPrice","type":"uint256"}],"name":"setSalePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_startTime","type":"uint256"}],"name":"setStartTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"address","name":"_address","type":"address"}],"name":"treasuryMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"}],"internalType":"struct EnigmaMiningFactionsTwo.Whitelist[]","name":"users","type":"tuple[]"}],"name":"whitelistForPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"}],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"}]

610fa0600a556019600b556000600c819055600d819055600e8190556002600f5560fa60105560118190556012805461ffff19169055636403f7a060135560a0604052608090815260149062000056908262000242565b50601580546001600160a01b03191673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb481790553480156200008a57600080fd5b506040518060400160405280601781526020017f456e69676d614d696e696e6746616374696f6e7354776f0000000000000000008152506040518060400160405280600481526020016322a6a31960e11b815250620000f8620000f26200014960201b60201c565b6200014d565b600362000106838262000242565b50600462000115828262000242565b5060006001555050600980546001600160a01b031916735f4ec3df9cbd43714fe2740f5e3616155c5b84191790556200030e565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620001c857607f821691505b602082108103620001e957634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200023d57600081815260208120601f850160051c81016020861015620002185750805b601f850160051c820191505b81811015620002395782815560010162000224565b5050505b505050565b81516001600160401b038111156200025e576200025e6200019d565b62000276816200026f8454620001b3565b84620001ef565b602080601f831160018114620002ae5760008415620002955750858301515b600019600386901b1c1916600185901b17855562000239565b600085815260208120601f198616915b82811015620002df57888601518255948401946001909101908401620002be565b5085821015620002fe5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61283b806200031e6000396000f3fe6080604052600436106102c95760003560e01c8063715018a611610175578063b67c25a3116100dc578063e531b23011610095578063f2a3013e1161006f578063f2a3013e14610840578063f2fde38b14610860578063fa09e63014610880578063fc5eb693146108a057600080fd5b8063e531b230146107f4578063e985e9c51461080a578063f0292a031461082a57600080fd5b8063b67c25a31461074c578063b88d4fde1461076b578063be9a7cd51461078b578063c70e5515146107ab578063c87b56dd146107c1578063c9b298f1146107e157600080fd5b80638da5cb5b1161012e5780638da5cb5b14610699578063912d19e9146106b757806395d89b41146106d7578063a22cb465146106ec578063a7b4058c1461070c578063b61ff93c1461072c57600080fd5b8063715018a6146105ee57806375467c3d1461060357806378e979251461062357806379c9cb7b146106395780637eed5dc51461065957806389a302711461067957600080fd5b80631f73d8d41161023457806342842e0e116101ed5780635be50521116101c75780635be50521146105825780636352211e146105985780636817c76c146105b857806370a08231146105ce57600080fd5b806342842e0e1461051557806355f804b314610535578063564c2c591461055557600080fd5b80631f73d8d41461046257806323b872dd146104825780633549345e146104a25780633a329d95146104c25780633c8eb6f7146104e25780633e0a322d146104f557600080fd5b8063095ea7b311610286578063095ea7b3146103b957806309ec7ba9146103d95780630e60fd3a146103f357806315cbc9621461040957806318160ddd146104295780631919fed71461044257600080fd5b8063014670ad146102ce57806301ffc9a7146102f057806306fdde0314610325578063081812fc14610347578063093d8c641461037f57806309514653146103a3575b600080fd5b3480156102da57600080fd5b506102ee6102e9366004612048565b6108d6565b005b3480156102fc57600080fd5b5061031061030b366004612077565b6108e3565b60405190151581526020015b60405180910390f35b34801561033157600080fd5b5061033a610935565b60405161031c91906120e4565b34801561035357600080fd5b50610367610362366004612048565b6109c7565b6040516001600160a01b03909116815260200161031c565b34801561038b57600080fd5b50610395600a5481565b60405190815260200161031c565b3480156103af57600080fd5b50610395600c5481565b3480156103c557600080fd5b506102ee6103d4366004612113565b610a0b565b3480156103e557600080fd5b506012546103109060ff1681565b3480156103ff57600080fd5b50610395600d5481565b34801561041557600080fd5b506102ee610424366004612048565b610aab565b34801561043557600080fd5b5060025460015403610395565b34801561044e57600080fd5b506102ee61045d366004612048565b610ab8565b34801561046e57600080fd5b5061039561047d366004612048565b610ac5565b34801561048e57600080fd5b506102ee61049d36600461213d565b610b99565b3480156104ae57600080fd5b506102ee6104bd366004612048565b610d4b565b3480156104ce57600080fd5b506102ee6104dd366004612048565b610d58565b6102ee6104f0366004612179565b610d65565b34801561050157600080fd5b506102ee610510366004612048565b6111ab565b34801561052157600080fd5b506102ee61053036600461213d565b6111b8565b34801561054157600080fd5b506102ee6105503660046121ad565b6111d3565b34801561056157600080fd5b5061039561057036600461221f565b60166020526000908152604090205481565b34801561058e57600080fd5b5061039560115481565b3480156105a457600080fd5b506103676105b3366004612048565b6111e8565b3480156105c457600080fd5b5061039560105481565b3480156105da57600080fd5b506103956105e936600461221f565b6111f3565b3480156105fa57600080fd5b506102ee611242565b34801561060f57600080fd5b506102ee61061e366004612048565b611256565b34801561062f57600080fd5b5061039560135481565b34801561064557600080fd5b506102ee610654366004612048565b611263565b34801561066557600080fd5b506102ee610674366004612048565b611270565b34801561068557600080fd5b50601554610367906001600160a01b031681565b3480156106a557600080fd5b506000546001600160a01b0316610367565b3480156106c357600080fd5b506102ee6106d2366004612113565b611312565b3480156106e357600080fd5b5061033a6113ee565b3480156106f857600080fd5b506102ee610707366004612248565b6113fd565b34801561071857600080fd5b506102ee610727366004612274565b611492565b34801561073857600080fd5b506102ee610747366004612274565b6114ad565b34801561075857600080fd5b5060125461031090610100900460ff1681565b34801561077757600080fd5b506102ee610786366004612301565b6114cf565b34801561079757600080fd5b506102ee6107a63660046123c1565b611513565b3480156107b757600080fd5b50610395600e5481565b3480156107cd57600080fd5b5061033a6107dc366004612048565b611691565b6102ee6107ef366004612048565b611715565b34801561080057600080fd5b50610395600f5481565b34801561081657600080fd5b50610310610825366004612495565b6119f2565b34801561083657600080fd5b50610395600b5481565b34801561084c57600080fd5b506102ee61085b3660046124c8565b611a20565b34801561086c57600080fd5b506102ee61087b36600461221f565b611abf565b34801561088c57600080fd5b506102ee61089b36600461221f565b611b38565b3480156108ac57600080fd5b506103956108bb36600461221f565b6001600160a01b031660009081526016602052604090205490565b6108de611cd1565b600c55565b60006301ffc9a760e01b6001600160e01b03198316148061091457506380ac58cd60e01b6001600160e01b03198316145b8061092f5750635b5e139f60e01b6001600160e01b03198316145b92915050565b606060038054610944906124eb565b80601f0160208091040260200160405190810160405280929190818152602001828054610970906124eb565b80156109bd5780601f10610992576101008083540402835291602001916109bd565b820191906000526020600020905b8154815290600101906020018083116109a057829003601f168201915b5050505050905090565b60006109d282611d2b565b6109ef576040516333d1c03960e21b815260040160405180910390fd5b506000908152600760205260409020546001600160a01b031690565b6000610a16826111e8565b9050336001600160a01b03821614610a4f57610a3281336119f2565b610a4f576040516367d9dca160e11b815260040160405180910390fd5b60008281526007602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b610ab3611cd1565b600e55565b610ac0611cd1565b601055565b600080600960009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3f919061253f565b5050509150506000816402540be400610b5891906125a5565b90506000610b6e85670de0b6b3a76400006125a5565b9050600082610b8583670de0b6b3a76400006125a5565b610b8f91906125bc565b9695505050505050565b6000610ba482611d53565b9050836001600160a01b0316816001600160a01b031614610bd75760405162a1148160e81b815260040160405180910390fd5b60008281526007602052604090208054338082146001600160a01b03881690911417610c2457610c0786336119f2565b610c2457604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610c4b57604051633a954ecd60e21b815260040160405180910390fd5b610c5886868660016111a4565b8015610c6357600082555b6001600160a01b038681166000908152600660205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260056020526040812091909155600160e11b84169003610cf557600184016000818152600560205260408120549003610cf3576001548114610cf35760008181526005602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4610d4386868660016111a4565b505050505050565b610d53611cd1565b601155565b610d60611cd1565b600a55565b333214610d7157600080fd5b60135415801590610d8457504260135411155b610dc85760405162461bcd60e51b815260206004820152601060248201526f29b0b6329034b9903737ba1037b832b760811b60448201526064015b60405180910390fd5b60125460ff610100909104161515600114610e3a5760405162461bcd60e51b815260206004820152602c60248201527f4572726f723a205075626c6963206d696e742069736e2774206163746976652060448201526b1bdc881a185cc8195b99195960a21b6064820152608401610dbf565b600b54821115610e8c5760405162461bcd60e51b815260206004820152601a60248201527f4572726f723a2045786365656473204d6178207065722054584e0000000000006044820152606401610dbf565b600a54600e5483610ea06002546001540390565b610eaa91906125de565b610eb491906125de565b1115610f025760405162461bcd60e51b815260206004820152601d60248201527f4572726f723a2045786365656473204d617820416c6c6f636174696f6e0000006044820152606401610dbf565b600060105483610f1291906125a5565b90506000826001811115610f2857610f286125f1565b0361100b576000610f3882610ac5565b905060006064600f546064610f4d9190612607565b610f5790846125a5565b610f6191906125bc565b905060006064600f546064610f7691906125de565b610f8090856125a5565b610f8a91906125bc565b9050813410158015610f9c5750803411155b610fe15760405162461bcd60e51b815260206004820152601660248201527546443a20496e73756666696369656e742066756e647360501b6044820152606401610dbf565b610feb3387611dba565b85600d6000828254610ffd91906125de565b909155506111a69350505050565b60006001836001811115611021576110216125f1565b036111a45750601554604051636eb1769f60e11b81523360048201523060248201526001600160a01b03909116908290829063dd62ed3e90604401602060405180830381865afa158015611079573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109d919061261a565b10156110eb5760405162461bcd60e51b815260206004820152601b60248201527f4572726f723a204e6f7420656e6f75676820616c6c6f77616e636500000000006044820152606401610dbf565b6001600160a01b0381166323b872dd333061110986620f42406125a5565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af115801561115d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111819190612633565b5061118c3385611dba565b83600d600082825461119e91906125de565b90915550505b505b505050565b6111b3611cd1565b601355565b6111a6838383604051806020016040528060008152506114cf565b6111db611cd1565b60146111a6828483612696565b600061092f82611d53565b60006001600160a01b03821661121c576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526006602052604090205467ffffffffffffffff1690565b61124a611cd1565b6112546000611eaf565b565b61125e611cd1565b600d55565b61126b611cd1565b600b55565b611278611cd1565b600081116112bc5760405162461bcd60e51b815260206004820152601160248201527004572726f723a2043616e2774206265203607c1b6044820152606401610dbf565b600f54810361130d5760405162461bcd60e51b815260206004820152601b60248201527f4572726f723a2053616d652076616c7565206173206265666f726500000000006044820152606401610dbf565b600f55565b61131a611cd1565b6001600160a01b038216600090815260166020526040902054156113d2576001600160a01b038216600090815260166020526040902054811015611398576001600160a01b03821660009081526016602052604090205461137c908290612607565b600e600082825461138d9190612607565b909155506113d29050565b6001600160a01b0382166000908152601660205260409020546113bb9082612607565b600e60008282546113cc91906125de565b90915550505b6001600160a01b03909116600090815260166020526040902055565b606060048054610944906124eb565b336001600160a01b038316036114265760405163b06307db60e01b815260040160405180910390fd5b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61149a611cd1565b6012805460ff1916911515919091179055565b6114b5611cd1565b601280549115156101000261ff0019909216919091179055565b6114da848484610b99565b6001600160a01b0383163b156111a4576114f684848484611eff565b6111a4576040516368d2bf6b60e11b815260040160405180910390fd5b61151b611cd1565b60005b815181101561168d5760006016600084848151811061153f5761153f612757565b6020026020010151600001516001600160a01b03166001600160a01b031681526020019081526020016000205411156115ec5781818151811061158457611584612757565b602002602001015160200151601660008484815181106115a6576115a6612757565b6020026020010151600001516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546115e191906125de565b909155506116469050565b8181815181106115fe576115fe612757565b6020026020010151602001516016600084848151811061162057611620612757565b602090810291909101810151516001600160a01b03168252810191909152604001600020555b81818151811061165857611658612757565b602002602001015160200151600e600082825461167591906125de565b909155508190506116858161276d565b91505061151e565b5050565b606061169c82611d2b565b6116b957604051630a14c4b560e41b815260040160405180910390fd5b60006116c3611fea565b905080516000036116e3576040518060200160405280600081525061170e565b806116ed84611ff9565b6040516020016116fe929190612786565b6040516020818303038152906040525b9392505050565b33321461172157600080fd5b6013541580159061173457504260135411155b6117735760405162461bcd60e51b815260206004820152601060248201526f29b0b6329034b9903737ba1037b832b760811b6044820152606401610dbf565b33600090815260166020526040902054806117d05760405162461bcd60e51b815260206004820152601c60248201527f4572726f723a204e6f207265736572766174696f6e7320666f756e64000000006044820152606401610dbf565b818110156118205760405162461bcd60e51b815260206004820152601e60248201527f4572726f723a204e6f7420656e6f756768207265736572766174696f6e7300006044820152606401610dbf565b600082116118675760405162461bcd60e51b81526020600482015260146024820152734572726f723a20496e76616c69642076616c756560601b6044820152606401610dbf565b60125460ff1615156001146118d45760405162461bcd60e51b815260206004820152602d60248201527f4572726f723a2050726573616c65204d696e742069736e27742061637469766560448201526c081bdc881a185cc8195b991959609a1b6064820152608401610dbf565b600b548211156119265760405162461bcd60e51b815260206004820152601a60248201527f4572726f723a2045786365656473204d6178207065722054584e0000000000006044820152606401610dbf565b600a54826119376002546001540390565b61194191906125de565b111561198f5760405162461bcd60e51b815260206004820152601d60248201527f4572726f723a2045786365656473204d617820416c6c6f636174696f6e0000006044820152606401610dbf565b33600090815260166020526040812080548492906119ae908490612607565b909155506119be90503383611dba565b81600c60008282546119d091906125de565b9250508190555081600e60008282546119e99190612607565b90915550505050565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b611a28611cd1565b600a5482611a396002546001540390565b611a4391906125de565b1115611aa35760405162461bcd60e51b815260206004820152602960248201527f4572726f723a2043616e6e6f74206d696e74206d6f7265207468616e20746f74604482015268616c20737570706c7960b81b6064820152608401610dbf565b611aad8183611dba565b81600d60008282546119e991906125de565b611ac7611cd1565b6001600160a01b038116611b2c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610dbf565b611b3581611eaf565b50565b611b40611cd1565b60405147906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611b78573d6000803e3d6000fd5b506015546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611bc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be6919061261a565b111561168d576015546040516370a0823160e01b81523060048201526001600160a01b039091169063a9059cbb90849083906370a0823190602401602060405180830381865afa158015611c3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c62919061261a565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611cad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a69190612633565b6000546001600160a01b031633146112545760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610dbf565b60006001548210801561092f575050600090815260056020526040902054600160e01b161590565b600081600154811015611da15760008181526005602052604081205490600160e01b82169003611d9f575b8060000361170e575060001901600081815260056020526040902054611d7e565b505b604051636f96cda160e11b815260040160405180910390fd5b6001546001600160a01b038316611de357604051622e076360e81b815260040160405180910390fd5b81600003611e045760405163b562e8dd60e01b815260040160405180910390fd5b611e1160008483856111a4565b6001600160a01b038316600081815260066020526040902080546801000000000000000185020190554260a01b6001841460e11b1717600082815260056020526040902055808281015b6040516001830192906001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210611e5b57600155506111a660008483856111a4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611f349033908990889088906004016127b5565b6020604051808303816000875af1925050508015611f6f575060408051601f3d908101601f19168201909252611f6c918101906127e8565b60015b611fcd573d808015611f9d576040519150601f19603f3d011682016040523d82523d6000602084013e611fa2565b606091505b508051600003611fc5576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b606060148054610944906124eb565b604080516080810191829052607f0190826030600a8206018353600a90045b801561203657600183039250600a81066030018353600a9004612018565b50819003601f19909101908152919050565b60006020828403121561205a57600080fd5b5035919050565b6001600160e01b031981168114611b3557600080fd5b60006020828403121561208957600080fd5b813561170e81612061565b60005b838110156120af578181015183820152602001612097565b50506000910152565b600081518084526120d0816020860160208601612094565b601f01601f19169290920160200192915050565b60208152600061170e60208301846120b8565b80356001600160a01b038116811461210e57600080fd5b919050565b6000806040838503121561212657600080fd5b61212f836120f7565b946020939093013593505050565b60008060006060848603121561215257600080fd5b61215b846120f7565b9250612169602085016120f7565b9150604084013590509250925092565b6000806040838503121561218c57600080fd5b823591506020830135600281106121a257600080fd5b809150509250929050565b600080602083850312156121c057600080fd5b823567ffffffffffffffff808211156121d857600080fd5b818501915085601f8301126121ec57600080fd5b8135818111156121fb57600080fd5b86602082850101111561220d57600080fd5b60209290920196919550909350505050565b60006020828403121561223157600080fd5b61170e826120f7565b8015158114611b3557600080fd5b6000806040838503121561225b57600080fd5b612264836120f7565b915060208301356121a28161223a565b60006020828403121561228657600080fd5b813561170e8161223a565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156122ca576122ca612291565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156122f9576122f9612291565b604052919050565b6000806000806080858703121561231757600080fd5b612320856120f7565b9350602061232f8187016120f7565b935060408601359250606086013567ffffffffffffffff8082111561235357600080fd5b818801915088601f83011261236757600080fd5b81358181111561237957612379612291565b61238b601f8201601f191685016122d0565b915080825289848285010111156123a157600080fd5b808484018584013760008482840101525080935050505092959194509250565b600060208083850312156123d457600080fd5b823567ffffffffffffffff808211156123ec57600080fd5b818501915085601f83011261240057600080fd5b81358181111561241257612412612291565b612420848260051b016122d0565b818152848101925060069190911b83018401908782111561244057600080fd5b928401925b8184101561248a576040848903121561245e5760008081fd5b6124666122a7565b61246f856120f7565b81528486013586820152835260409093019291840191612445565b979650505050505050565b600080604083850312156124a857600080fd5b6124b1836120f7565b91506124bf602084016120f7565b90509250929050565b600080604083850312156124db57600080fd5b823591506124bf602084016120f7565b600181811c908216806124ff57607f821691505b60208210810361251f57634e487b7160e01b600052602260045260246000fd5b50919050565b805169ffffffffffffffffffff8116811461210e57600080fd5b600080600080600060a0868803121561255757600080fd5b61256086612525565b945060208601519350604086015192506060860151915061258360808701612525565b90509295509295909350565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761092f5761092f61258f565b6000826125d957634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561092f5761092f61258f565b634e487b7160e01b600052602160045260246000fd5b8181038181111561092f5761092f61258f565b60006020828403121561262c57600080fd5b5051919050565b60006020828403121561264557600080fd5b815161170e8161223a565b601f8211156111a657600081815260208120601f850160051c810160208610156126775750805b601f850160051c820191505b81811015610d4357828155600101612683565b67ffffffffffffffff8311156126ae576126ae612291565b6126c2836126bc83546124eb565b83612650565b6000601f8411600181146126f657600085156126de5750838201355b600019600387901b1c1916600186901b178355612750565b600083815260209020601f19861690835b828110156127275786850135825560209485019460019092019101612707565b50868210156127445760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161277f5761277f61258f565b5060010190565b60008351612798818460208801612094565b8351908301906127ac818360208801612094565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090610b8f908301846120b8565b6000602082840312156127fa57600080fd5b815161170e8161206156fea26469706673582212204276240c7f223eca18f9053747f9e9ef25e0ff16dc7efe010f9dc61dce51c68964736f6c63430008120033

Deployed Bytecode

0x6080604052600436106102c95760003560e01c8063715018a611610175578063b67c25a3116100dc578063e531b23011610095578063f2a3013e1161006f578063f2a3013e14610840578063f2fde38b14610860578063fa09e63014610880578063fc5eb693146108a057600080fd5b8063e531b230146107f4578063e985e9c51461080a578063f0292a031461082a57600080fd5b8063b67c25a31461074c578063b88d4fde1461076b578063be9a7cd51461078b578063c70e5515146107ab578063c87b56dd146107c1578063c9b298f1146107e157600080fd5b80638da5cb5b1161012e5780638da5cb5b14610699578063912d19e9146106b757806395d89b41146106d7578063a22cb465146106ec578063a7b4058c1461070c578063b61ff93c1461072c57600080fd5b8063715018a6146105ee57806375467c3d1461060357806378e979251461062357806379c9cb7b146106395780637eed5dc51461065957806389a302711461067957600080fd5b80631f73d8d41161023457806342842e0e116101ed5780635be50521116101c75780635be50521146105825780636352211e146105985780636817c76c146105b857806370a08231146105ce57600080fd5b806342842e0e1461051557806355f804b314610535578063564c2c591461055557600080fd5b80631f73d8d41461046257806323b872dd146104825780633549345e146104a25780633a329d95146104c25780633c8eb6f7146104e25780633e0a322d146104f557600080fd5b8063095ea7b311610286578063095ea7b3146103b957806309ec7ba9146103d95780630e60fd3a146103f357806315cbc9621461040957806318160ddd146104295780631919fed71461044257600080fd5b8063014670ad146102ce57806301ffc9a7146102f057806306fdde0314610325578063081812fc14610347578063093d8c641461037f57806309514653146103a3575b600080fd5b3480156102da57600080fd5b506102ee6102e9366004612048565b6108d6565b005b3480156102fc57600080fd5b5061031061030b366004612077565b6108e3565b60405190151581526020015b60405180910390f35b34801561033157600080fd5b5061033a610935565b60405161031c91906120e4565b34801561035357600080fd5b50610367610362366004612048565b6109c7565b6040516001600160a01b03909116815260200161031c565b34801561038b57600080fd5b50610395600a5481565b60405190815260200161031c565b3480156103af57600080fd5b50610395600c5481565b3480156103c557600080fd5b506102ee6103d4366004612113565b610a0b565b3480156103e557600080fd5b506012546103109060ff1681565b3480156103ff57600080fd5b50610395600d5481565b34801561041557600080fd5b506102ee610424366004612048565b610aab565b34801561043557600080fd5b5060025460015403610395565b34801561044e57600080fd5b506102ee61045d366004612048565b610ab8565b34801561046e57600080fd5b5061039561047d366004612048565b610ac5565b34801561048e57600080fd5b506102ee61049d36600461213d565b610b99565b3480156104ae57600080fd5b506102ee6104bd366004612048565b610d4b565b3480156104ce57600080fd5b506102ee6104dd366004612048565b610d58565b6102ee6104f0366004612179565b610d65565b34801561050157600080fd5b506102ee610510366004612048565b6111ab565b34801561052157600080fd5b506102ee61053036600461213d565b6111b8565b34801561054157600080fd5b506102ee6105503660046121ad565b6111d3565b34801561056157600080fd5b5061039561057036600461221f565b60166020526000908152604090205481565b34801561058e57600080fd5b5061039560115481565b3480156105a457600080fd5b506103676105b3366004612048565b6111e8565b3480156105c457600080fd5b5061039560105481565b3480156105da57600080fd5b506103956105e936600461221f565b6111f3565b3480156105fa57600080fd5b506102ee611242565b34801561060f57600080fd5b506102ee61061e366004612048565b611256565b34801561062f57600080fd5b5061039560135481565b34801561064557600080fd5b506102ee610654366004612048565b611263565b34801561066557600080fd5b506102ee610674366004612048565b611270565b34801561068557600080fd5b50601554610367906001600160a01b031681565b3480156106a557600080fd5b506000546001600160a01b0316610367565b3480156106c357600080fd5b506102ee6106d2366004612113565b611312565b3480156106e357600080fd5b5061033a6113ee565b3480156106f857600080fd5b506102ee610707366004612248565b6113fd565b34801561071857600080fd5b506102ee610727366004612274565b611492565b34801561073857600080fd5b506102ee610747366004612274565b6114ad565b34801561075857600080fd5b5060125461031090610100900460ff1681565b34801561077757600080fd5b506102ee610786366004612301565b6114cf565b34801561079757600080fd5b506102ee6107a63660046123c1565b611513565b3480156107b757600080fd5b50610395600e5481565b3480156107cd57600080fd5b5061033a6107dc366004612048565b611691565b6102ee6107ef366004612048565b611715565b34801561080057600080fd5b50610395600f5481565b34801561081657600080fd5b50610310610825366004612495565b6119f2565b34801561083657600080fd5b50610395600b5481565b34801561084c57600080fd5b506102ee61085b3660046124c8565b611a20565b34801561086c57600080fd5b506102ee61087b36600461221f565b611abf565b34801561088c57600080fd5b506102ee61089b36600461221f565b611b38565b3480156108ac57600080fd5b506103956108bb36600461221f565b6001600160a01b031660009081526016602052604090205490565b6108de611cd1565b600c55565b60006301ffc9a760e01b6001600160e01b03198316148061091457506380ac58cd60e01b6001600160e01b03198316145b8061092f5750635b5e139f60e01b6001600160e01b03198316145b92915050565b606060038054610944906124eb565b80601f0160208091040260200160405190810160405280929190818152602001828054610970906124eb565b80156109bd5780601f10610992576101008083540402835291602001916109bd565b820191906000526020600020905b8154815290600101906020018083116109a057829003601f168201915b5050505050905090565b60006109d282611d2b565b6109ef576040516333d1c03960e21b815260040160405180910390fd5b506000908152600760205260409020546001600160a01b031690565b6000610a16826111e8565b9050336001600160a01b03821614610a4f57610a3281336119f2565b610a4f576040516367d9dca160e11b815260040160405180910390fd5b60008281526007602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b610ab3611cd1565b600e55565b610ac0611cd1565b601055565b600080600960009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610b1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3f919061253f565b5050509150506000816402540be400610b5891906125a5565b90506000610b6e85670de0b6b3a76400006125a5565b9050600082610b8583670de0b6b3a76400006125a5565b610b8f91906125bc565b9695505050505050565b6000610ba482611d53565b9050836001600160a01b0316816001600160a01b031614610bd75760405162a1148160e81b815260040160405180910390fd5b60008281526007602052604090208054338082146001600160a01b03881690911417610c2457610c0786336119f2565b610c2457604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610c4b57604051633a954ecd60e21b815260040160405180910390fd5b610c5886868660016111a4565b8015610c6357600082555b6001600160a01b038681166000908152600660205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260056020526040812091909155600160e11b84169003610cf557600184016000818152600560205260408120549003610cf3576001548114610cf35760008181526005602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4610d4386868660016111a4565b505050505050565b610d53611cd1565b601155565b610d60611cd1565b600a55565b333214610d7157600080fd5b60135415801590610d8457504260135411155b610dc85760405162461bcd60e51b815260206004820152601060248201526f29b0b6329034b9903737ba1037b832b760811b60448201526064015b60405180910390fd5b60125460ff610100909104161515600114610e3a5760405162461bcd60e51b815260206004820152602c60248201527f4572726f723a205075626c6963206d696e742069736e2774206163746976652060448201526b1bdc881a185cc8195b99195960a21b6064820152608401610dbf565b600b54821115610e8c5760405162461bcd60e51b815260206004820152601a60248201527f4572726f723a2045786365656473204d6178207065722054584e0000000000006044820152606401610dbf565b600a54600e5483610ea06002546001540390565b610eaa91906125de565b610eb491906125de565b1115610f025760405162461bcd60e51b815260206004820152601d60248201527f4572726f723a2045786365656473204d617820416c6c6f636174696f6e0000006044820152606401610dbf565b600060105483610f1291906125a5565b90506000826001811115610f2857610f286125f1565b0361100b576000610f3882610ac5565b905060006064600f546064610f4d9190612607565b610f5790846125a5565b610f6191906125bc565b905060006064600f546064610f7691906125de565b610f8090856125a5565b610f8a91906125bc565b9050813410158015610f9c5750803411155b610fe15760405162461bcd60e51b815260206004820152601660248201527546443a20496e73756666696369656e742066756e647360501b6044820152606401610dbf565b610feb3387611dba565b85600d6000828254610ffd91906125de565b909155506111a69350505050565b60006001836001811115611021576110216125f1565b036111a45750601554604051636eb1769f60e11b81523360048201523060248201526001600160a01b03909116908290829063dd62ed3e90604401602060405180830381865afa158015611079573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109d919061261a565b10156110eb5760405162461bcd60e51b815260206004820152601b60248201527f4572726f723a204e6f7420656e6f75676820616c6c6f77616e636500000000006044820152606401610dbf565b6001600160a01b0381166323b872dd333061110986620f42406125a5565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af115801561115d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111819190612633565b5061118c3385611dba565b83600d600082825461119e91906125de565b90915550505b505b505050565b6111b3611cd1565b601355565b6111a6838383604051806020016040528060008152506114cf565b6111db611cd1565b60146111a6828483612696565b600061092f82611d53565b60006001600160a01b03821661121c576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b031660009081526006602052604090205467ffffffffffffffff1690565b61124a611cd1565b6112546000611eaf565b565b61125e611cd1565b600d55565b61126b611cd1565b600b55565b611278611cd1565b600081116112bc5760405162461bcd60e51b815260206004820152601160248201527004572726f723a2043616e2774206265203607c1b6044820152606401610dbf565b600f54810361130d5760405162461bcd60e51b815260206004820152601b60248201527f4572726f723a2053616d652076616c7565206173206265666f726500000000006044820152606401610dbf565b600f55565b61131a611cd1565b6001600160a01b038216600090815260166020526040902054156113d2576001600160a01b038216600090815260166020526040902054811015611398576001600160a01b03821660009081526016602052604090205461137c908290612607565b600e600082825461138d9190612607565b909155506113d29050565b6001600160a01b0382166000908152601660205260409020546113bb9082612607565b600e60008282546113cc91906125de565b90915550505b6001600160a01b03909116600090815260166020526040902055565b606060048054610944906124eb565b336001600160a01b038316036114265760405163b06307db60e01b815260040160405180910390fd5b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61149a611cd1565b6012805460ff1916911515919091179055565b6114b5611cd1565b601280549115156101000261ff0019909216919091179055565b6114da848484610b99565b6001600160a01b0383163b156111a4576114f684848484611eff565b6111a4576040516368d2bf6b60e11b815260040160405180910390fd5b61151b611cd1565b60005b815181101561168d5760006016600084848151811061153f5761153f612757565b6020026020010151600001516001600160a01b03166001600160a01b031681526020019081526020016000205411156115ec5781818151811061158457611584612757565b602002602001015160200151601660008484815181106115a6576115a6612757565b6020026020010151600001516001600160a01b03166001600160a01b0316815260200190815260200160002060008282546115e191906125de565b909155506116469050565b8181815181106115fe576115fe612757565b6020026020010151602001516016600084848151811061162057611620612757565b602090810291909101810151516001600160a01b03168252810191909152604001600020555b81818151811061165857611658612757565b602002602001015160200151600e600082825461167591906125de565b909155508190506116858161276d565b91505061151e565b5050565b606061169c82611d2b565b6116b957604051630a14c4b560e41b815260040160405180910390fd5b60006116c3611fea565b905080516000036116e3576040518060200160405280600081525061170e565b806116ed84611ff9565b6040516020016116fe929190612786565b6040516020818303038152906040525b9392505050565b33321461172157600080fd5b6013541580159061173457504260135411155b6117735760405162461bcd60e51b815260206004820152601060248201526f29b0b6329034b9903737ba1037b832b760811b6044820152606401610dbf565b33600090815260166020526040902054806117d05760405162461bcd60e51b815260206004820152601c60248201527f4572726f723a204e6f207265736572766174696f6e7320666f756e64000000006044820152606401610dbf565b818110156118205760405162461bcd60e51b815260206004820152601e60248201527f4572726f723a204e6f7420656e6f756768207265736572766174696f6e7300006044820152606401610dbf565b600082116118675760405162461bcd60e51b81526020600482015260146024820152734572726f723a20496e76616c69642076616c756560601b6044820152606401610dbf565b60125460ff1615156001146118d45760405162461bcd60e51b815260206004820152602d60248201527f4572726f723a2050726573616c65204d696e742069736e27742061637469766560448201526c081bdc881a185cc8195b991959609a1b6064820152608401610dbf565b600b548211156119265760405162461bcd60e51b815260206004820152601a60248201527f4572726f723a2045786365656473204d6178207065722054584e0000000000006044820152606401610dbf565b600a54826119376002546001540390565b61194191906125de565b111561198f5760405162461bcd60e51b815260206004820152601d60248201527f4572726f723a2045786365656473204d617820416c6c6f636174696f6e0000006044820152606401610dbf565b33600090815260166020526040812080548492906119ae908490612607565b909155506119be90503383611dba565b81600c60008282546119d091906125de565b9250508190555081600e60008282546119e99190612607565b90915550505050565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b611a28611cd1565b600a5482611a396002546001540390565b611a4391906125de565b1115611aa35760405162461bcd60e51b815260206004820152602960248201527f4572726f723a2043616e6e6f74206d696e74206d6f7265207468616e20746f74604482015268616c20737570706c7960b81b6064820152608401610dbf565b611aad8183611dba565b81600d60008282546119e991906125de565b611ac7611cd1565b6001600160a01b038116611b2c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610dbf565b611b3581611eaf565b50565b611b40611cd1565b60405147906001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611b78573d6000803e3d6000fd5b506015546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015611bc2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be6919061261a565b111561168d576015546040516370a0823160e01b81523060048201526001600160a01b039091169063a9059cbb90849083906370a0823190602401602060405180830381865afa158015611c3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c62919061261a565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015611cad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a69190612633565b6000546001600160a01b031633146112545760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610dbf565b60006001548210801561092f575050600090815260056020526040902054600160e01b161590565b600081600154811015611da15760008181526005602052604081205490600160e01b82169003611d9f575b8060000361170e575060001901600081815260056020526040902054611d7e565b505b604051636f96cda160e11b815260040160405180910390fd5b6001546001600160a01b038316611de357604051622e076360e81b815260040160405180910390fd5b81600003611e045760405163b562e8dd60e01b815260040160405180910390fd5b611e1160008483856111a4565b6001600160a01b038316600081815260066020526040902080546801000000000000000185020190554260a01b6001841460e11b1717600082815260056020526040902055808281015b6040516001830192906001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4808210611e5b57600155506111a660008483856111a4565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611f349033908990889088906004016127b5565b6020604051808303816000875af1925050508015611f6f575060408051601f3d908101601f19168201909252611f6c918101906127e8565b60015b611fcd573d808015611f9d576040519150601f19603f3d011682016040523d82523d6000602084013e611fa2565b606091505b508051600003611fc5576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b606060148054610944906124eb565b604080516080810191829052607f0190826030600a8206018353600a90045b801561203657600183039250600a81066030018353600a9004612018565b50819003601f19909101908152919050565b60006020828403121561205a57600080fd5b5035919050565b6001600160e01b031981168114611b3557600080fd5b60006020828403121561208957600080fd5b813561170e81612061565b60005b838110156120af578181015183820152602001612097565b50506000910152565b600081518084526120d0816020860160208601612094565b601f01601f19169290920160200192915050565b60208152600061170e60208301846120b8565b80356001600160a01b038116811461210e57600080fd5b919050565b6000806040838503121561212657600080fd5b61212f836120f7565b946020939093013593505050565b60008060006060848603121561215257600080fd5b61215b846120f7565b9250612169602085016120f7565b9150604084013590509250925092565b6000806040838503121561218c57600080fd5b823591506020830135600281106121a257600080fd5b809150509250929050565b600080602083850312156121c057600080fd5b823567ffffffffffffffff808211156121d857600080fd5b818501915085601f8301126121ec57600080fd5b8135818111156121fb57600080fd5b86602082850101111561220d57600080fd5b60209290920196919550909350505050565b60006020828403121561223157600080fd5b61170e826120f7565b8015158114611b3557600080fd5b6000806040838503121561225b57600080fd5b612264836120f7565b915060208301356121a28161223a565b60006020828403121561228657600080fd5b813561170e8161223a565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156122ca576122ca612291565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156122f9576122f9612291565b604052919050565b6000806000806080858703121561231757600080fd5b612320856120f7565b9350602061232f8187016120f7565b935060408601359250606086013567ffffffffffffffff8082111561235357600080fd5b818801915088601f83011261236757600080fd5b81358181111561237957612379612291565b61238b601f8201601f191685016122d0565b915080825289848285010111156123a157600080fd5b808484018584013760008482840101525080935050505092959194509250565b600060208083850312156123d457600080fd5b823567ffffffffffffffff808211156123ec57600080fd5b818501915085601f83011261240057600080fd5b81358181111561241257612412612291565b612420848260051b016122d0565b818152848101925060069190911b83018401908782111561244057600080fd5b928401925b8184101561248a576040848903121561245e5760008081fd5b6124666122a7565b61246f856120f7565b81528486013586820152835260409093019291840191612445565b979650505050505050565b600080604083850312156124a857600080fd5b6124b1836120f7565b91506124bf602084016120f7565b90509250929050565b600080604083850312156124db57600080fd5b823591506124bf602084016120f7565b600181811c908216806124ff57607f821691505b60208210810361251f57634e487b7160e01b600052602260045260246000fd5b50919050565b805169ffffffffffffffffffff8116811461210e57600080fd5b600080600080600060a0868803121561255757600080fd5b61256086612525565b945060208601519350604086015192506060860151915061258360808701612525565b90509295509295909350565b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761092f5761092f61258f565b6000826125d957634e487b7160e01b600052601260045260246000fd5b500490565b8082018082111561092f5761092f61258f565b634e487b7160e01b600052602160045260246000fd5b8181038181111561092f5761092f61258f565b60006020828403121561262c57600080fd5b5051919050565b60006020828403121561264557600080fd5b815161170e8161223a565b601f8211156111a657600081815260208120601f850160051c810160208610156126775750805b601f850160051c820191505b81811015610d4357828155600101612683565b67ffffffffffffffff8311156126ae576126ae612291565b6126c2836126bc83546124eb565b83612650565b6000601f8411600181146126f657600085156126de5750838201355b600019600387901b1c1916600186901b178355612750565b600083815260209020601f19861690835b828110156127275786850135825560209485019460019092019101612707565b50868210156127445760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b634e487b7160e01b600052603260045260246000fd5b60006001820161277f5761277f61258f565b5060010190565b60008351612798818460208801612094565b8351908301906127ac818360208801612094565b01949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090610b8f908301846120b8565b6000602082840312156127fa57600080fd5b815161170e8161206156fea26469706673582212204276240c7f223eca18f9053747f9e9ef25e0ff16dc7efe010f9dc61dce51c68964736f6c63430008120033

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.