ETH Price: $3,501.06 (-0.24%)
Gas: 1 Gwei

Contract

0x1cAfA2eB160C1FeAA9E8cc0495Ff435E21f99c1f
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
0x60806040165774172023-02-07 14:12:23529 days ago1675779143IN
 Create: ABDrop5
0 ETH0.0834198230.49630137

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ABDrop5

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 10 runs

Other Settings:
default evmVersion
File 1 of 17 : ABDrop5.sol
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                                                    ████████████████████
//                                                    ████████████████████
//                                                    ████████████████████
//                                                    ████████████████████
//
//
//  █████╗ ███╗   ██╗ ██████╗ ████████╗██╗  ██╗███████╗██████╗ ██████╗ ██╗      ██████╗  ██████╗██╗  ██╗
// ██╔══██╗████╗  ██║██╔═══██╗╚══██╔══╝██║  ██║██╔════╝██╔══██╗██╔══██╗██║     ██╔═══██╗██╔════╝██║ ██╔╝
// ███████║██╔██╗ ██║██║   ██║   ██║   ███████║█████╗  ██████╔╝██████╔╝██║     ██║   ██║██║     █████╔╝
// ██╔══██║██║╚██╗██║██║   ██║   ██║   ██╔══██║██╔══╝  ██╔══██╗██╔══██╗██║     ██║   ██║██║     ██╔═██╗
// ██║  ██║██║ ╚████║╚██████╔╝   ██║   ██║  ██║███████╗██║  ██║██████╔╝███████╗╚██████╔╝╚██████╗██║  ██╗
// ╚═╝  ╚═╝╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚══════╝ ╚═════╝  ╚═════╝╚═╝  ╚═╝
//
/**
 * @title ABDrop5
 * @author Anotherblock Technical Team
 * @notice Anotherblock NFT contract
 **/

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

/* Openzeppelin Contract */
import {MerkleProof} from '@openzeppelin/contracts/utils/cryptography/MerkleProof.sol';
import {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';

/* Custom Imports */
import {ERC721ABv2} from '../ERC721ABv2.sol';
import {IABDropManager} from '../interfaces/IABDropManager.sol';
import {ERC721ABErrors} from '../errors/ERC721ABErrors.sol';

contract ABDrop5 is ERC721ABv2, ERC721ABErrors {
    //     _____ __        __
    //    / ___// /_____ _/ /____  _____
    //    \__ \/ __/ __ `/ __/ _ \/ ___/
    //   ___/ / /_/ /_/ / /_/  __(__  )
    //  /____/\__/\__,_/\__/\___/____/

    /// @dev Base Token URI
    string private baseTokenURI;

    /// @dev Phase definition
    Phase[4] public phasesPerDrop;

    /// @dev Stores the amounts of tokens minted per address and per phase
    mapping(address => uint256) public mintedPerAddress;

    /// @dev Anotherblock PFP NFT contract interface
    IERC721 private AB_PFP;

    bool public genesisMinted;

    /**
     * @notice
     *  Phase Structure format
     *
     * @param phaseStart : timestamp at which the phase
     * @param maxMint : maximum number of token to be minted per user during the phase
     * @param merkle : merkle tree root containing user address and associated parameters
     */
    struct Phase {
        uint256 phaseStart;
        uint256 maxMint;
        bytes32 merkle;
    }

    /// @dev Event emitted upon phase update
    event UpdatedPhase(uint256 _dropId);

    //     ______                 __                  __
    //    / ____/___  ____  _____/ /________  _______/ /_____  _____
    //   / /   / __ \/ __ \/ ___/ __/ ___/ / / / ___/ __/ __ \/ ___/
    //  / /___/ /_/ / / / (__  ) /_/ /  / /_/ / /__/ /_/ /_/ / /
    //  \____/\____/_/ /_/____/\__/_/   \__,_/\___/\__/\____/_/

    /**
     * @notice
     *  Another721 contract constructor
     *
     * @param _dropManager Anotherblock Drop Manager contract address
     * @param _abPFP season 1 PFP contract address
     * @param _baseUri base token URI
     **/
    function initialize(
        address _dropManager,
        address _abPFP,
        string memory _baseUri
    ) external initializerERC721A initializer {
        __ERC721ABv2_init(_dropManager, 'Bitch Better Have My Money', 'DROP5');
        baseTokenURI = _baseUri;
        AB_PFP = IERC721(_abPFP);
        genesisMinted = false;
    }

    //     ______     __                        __   ______                 __  _
    //    / ____/  __/ /____  _________  ____ _/ /  / ____/_  ______  _____/ /_(_)___  ____  _____
    //   / __/ | |/_/ __/ _ \/ ___/ __ \/ __ `/ /  / /_  / / / / __ \/ ___/ __/ / __ \/ __ \/ ___/
    //  / /____>  </ /_/  __/ /  / / / / /_/ / /  / __/ / /_/ / / / / /__/ /_/ / /_/ / / / (__  )
    // /_____/_/|_|\__/\___/_/  /_/ /_/\__,_/_/  /_/    \__,_/_/ /_/\___/\__/_/\____/_/ /_/____/

    /**
     * @notice
     *  Let a PFP token holder mint `_quantity` token(s) of the given `_dropId`     *
     * @param _to recipient address
     * @param _quantity amount of tokens to be minted
     * @param _proof merkle tree proof used to verify whitelisted user
     */
    function mintPfpHolder(
        address _to,
        uint256 _quantity,
        bytes32[] memory _proof
    ) external payable verifyEligibility(_quantity, msg.value) {
        Phase memory phase = phasesPerDrop[0];

        // Check that the first phase has started (revert otherwise)
        if (block.timestamp < phase.phaseStart) revert SaleNotStarted();

        // Check that the user is eligible for this phase (is included in the merkle root)
        bool isWhitelisted = MerkleProof.verify(
            _proof,
            phase.merkle,
            keccak256(abi.encodePacked(_to))
        );
        if (!isWhitelisted) revert NotEligible();

        // Determine the maximum amount that can be minted by the user
        uint256 userPfpBalance = AB_PFP.balanceOf(_to);
        uint256 maxMint = phase.maxMint;
        if (userPfpBalance > 0) {
            maxMint = phase.maxMint * userPfpBalance;
        }
        // Check that user did not mint the maximum amount per address for the current phase
        if (mintedPerAddress[_to] + _quantity > maxMint)
            revert MaxMintPerAddress();

        mintedPerAddress[_to] += _quantity;
        IABDropManager(dropManager).updateDropCounter(dropId, _quantity);

        _mint(_to, _quantity);
    }

    /**
     * @notice
     *  Let a whitelisted user mint `_quantity` token(s) of the given `_dropId`
     *
     * @param _to : recipient address
     * @param _quantity : amount of tokens to be minted
     * @param _proof : merkle tree proof used to verify whitelisted user
     */
    function mintAllowlist(
        address _to,
        uint256 _quantity,
        bytes32[] memory _proof
    ) external payable verifyEligibility(_quantity, msg.value) {
        Phase memory phase = phasesPerDrop[1];

        // Check that the phase has started (revert otherwise)
        if (block.timestamp < phase.phaseStart) revert SaleNotStarted();

        bool isWhitelisted = MerkleProof.verify(
            _proof,
            phase.merkle,
            keccak256(abi.encodePacked(_to))
        );
        if (!isWhitelisted) {
            revert NotEligible();
        }

        // Determine the maximum amount that can be minted by the user
        uint256 userPfpBalance = AB_PFP.balanceOf(_to);
        uint256 maxMint = phase.maxMint;
        if (userPfpBalance > 0) {
            maxMint = phase.maxMint * userPfpBalance;
        }

        // Check that user did not mint the maximum amount per address for the current phase
        if (mintedPerAddress[_to] + _quantity > maxMint)
            revert MaxMintPerAddress();

        mintedPerAddress[_to] += _quantity;
        IABDropManager(dropManager).updateDropCounter(dropId, _quantity);

        _mint(_to, _quantity);
    }

    /**
     * @notice
     *  Let an user mint `_quantity` token(s) of the given `_dropId`
     *
     * @param _to : recipient address
     * @param _quantity : amount of tokens to be minted
     */
    function mintPublic(address _to, uint256 _quantity)
        external
        payable
        verifyEligibility(_quantity, msg.value)
    {
        Phase memory phase = phasesPerDrop[2];

        // Check that the phase has started (revert otherwise)
        if (block.timestamp < phase.phaseStart) revert SaleNotStarted();

        mintedPerAddress[_to] += _quantity;
        IABDropManager(dropManager).updateDropCounter(dropId, _quantity);

        _mint(_to, _quantity);
    }

    //
    //     ____        __         ____
    //    / __ \____  / /_  __   / __ \_      ______  ___  _____
    //   / / / / __ \/ / / / /  / / / / | /| / / __ \/ _ \/ ___/
    //  / /_/ / / / / / /_/ /  / /_/ /| |/ |/ / / / /  __/ /
    //  \____/_/ /_/_/\__, /   \____/ |__/|__/_/ /_/\___/_/
    //               /____/

    /**
     * @notice
     *  Mint 1 token to `_anothercollector` address
     *
     * @param _anothercollector : recipient address (another collector EOA)
     */
    function mintGenesis(address _anothercollector)
        external
        payable
        verifyEligibility(1, msg.value)
        onlyOwner
    {
        if (genesisMinted) revert Forbidden();
        IABDropManager(dropManager).updateDropCounter(dropId, 1);
        genesisMinted = true;

        _mint(_anothercollector, 1);
    }

    /**
     * @notice
     *  Withdraw mint proceeds to Anotherblock Treasury address
     *
     */
    function withdrawAll() external onlyOwner {
        (bool success, ) = IABDropManager(dropManager).treasury().call{
            value: address(this).balance
        }('');
        if (!success) revert TransferFailed();
    }

    /**
     * @notice
     *  Withdraw mint proceeds to the right holder address
     *
     * @param _amount : amount to be transferred
     */
    function withdrawToRightholder(uint256 _amount) external onlyOwner {
        IABDropManager.Drop memory drop = IABDropManager(dropManager).drops(
            dropId
        );
        if (drop.owner == address(0)) revert ZeroAddress();
        (bool success, ) = drop.owner.call{value: _amount}('');
        if (!success) revert TransferFailed();
    }

    /**
     * @notice
     *  Set the sale phases for drop
     *
     * @param _phases : array of phases to be set
     */
    function setDropPhases(Phase[4] memory _phases) external onlyOwner {
        phasesPerDrop[0] = _phases[0];
        phasesPerDrop[1] = _phases[1];
        phasesPerDrop[2] = _phases[2];
        phasesPerDrop[3] = _phases[3];

        emit UpdatedPhase(dropId);
    }

    /**
     * @notice
     *  Update the Base URI
     *  Only the contract owner can perform this operation
     *
     * @param _newBaseURI : new base URI
     */
    function setBaseURI(string calldata _newBaseURI) external onlyOwner {
        baseTokenURI = _newBaseURI;
    }

    //     ____      __                        __   ______                 __  _
    //    /  _/___  / /____  _________  ____ _/ /  / ____/_  ______  _____/ /_(_)___  ____  _____
    //    / // __ \/ __/ _ \/ ___/ __ \/ __ `/ /  / /_  / / / / __ \/ ___/ __/ / __ \/ __ \/ ___/
    //  _/ // / / / /_/  __/ /  / / / / /_/ / /  / __/ / /_/ / / / / /__/ /_/ / /_/ / / / (__  )
    // /___/_/ /_/\__/\___/_/  /_/ /_/\__,_/_/  /_/    \__,_/_/ /_/\___/\__/_/\____/_/ /_/____/

    /**
     * @notice
     *  Returns the base URI
     *
     * @return : base token URI state
     */
    function _baseURI() internal view virtual override returns (string memory) {
        return baseTokenURI;
    }

    /**
     * @notice
     *  Returns the starting token ID
     *
     * @return : Start token index
     */
    function _startTokenId() internal view virtual override returns (uint256) {
        return 1;
    }

    //      __  ___          ___ _____
    //     /  |/  /___  ____/ (_) __(_)__  _____
    //    / /|_/ / __ \/ __  / / /_/ / _ \/ ___/
    //   / /  / / /_/ / /_/ / / __/ /  __/ /
    //  /_/  /_/\____/\__,_/_/_/ /_/\___/_/

    /**
     * @notice
     *  Ensure that the mint parameters are correct
     *
     * @param _quantity amount of tokens to be minted
     * @param _amount amount ETH sent by the caller to the contract
     */
    modifier verifyEligibility(uint256 _quantity, uint256 _amount) {
        IABDropManager.Drop memory drop = IABDropManager(dropManager).drops(
            dropId
        );

        // Check if the Drop correspond to this NFT contract
        if (drop.nft != address(this)) revert InvalidDrop();

        // Check if the drop is not sold-out
        if (drop.sold == drop.tokenInfo.supply) revert DropSoldOut();

        // Check that there are enough tokens available for sale
        if (drop.sold + _quantity > drop.tokenInfo.supply)
            revert NotEnoughTokensAvailable();

        // Check that user is sending the correct amount of ETH (will revert if user send too much or not enough)
        if (_amount != drop.tokenInfo.price * _quantity)
            revert IncorrectETHSent();
        _;
    }
}

File 2 of 17 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * 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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

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

    function __Ownable_init_unchained() internal onlyInitializing {
        _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 anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing 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);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 3 of 17 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initialized`
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Internal function that returns the initialized version. Returns `_initializing`
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 4 of 17 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

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

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: 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);
}

File 7 of 17 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     *
     * _Available since v4.7._
     */
    function verifyCalldata(
        bytes32[] calldata proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     *
     * _Available since v4.7._
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * _Available since v4.7._
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * _Available since v4.7._
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`,
     * consuming from one or the other at each step according to the instructions given by
     * `proofFlags`.
     *
     * _Available since v4.7._
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}
     *
     * _Available since v4.7._
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof");

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            return hashes[totalHashes - 1];
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

File 8 of 17 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 9 of 17 : OperatorFilterer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @notice Optimized and flexible operator filterer to abide to OpenSea's
/// mandatory on-chain royalty enforcement in order for new collections to
/// receive royalties.
/// For more information, see:
/// See: https://github.com/ProjectOpenSea/operator-filter-registry
abstract contract OperatorFilterer {
    /// @dev The default OpenSea operator blocklist subscription.
    address internal constant _DEFAULT_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;

    /// @dev The OpenSea operator filter registry.
    address internal constant _OPERATOR_FILTER_REGISTRY = 0x000000000000AAeB6D7670E522A718067333cd4E;

    /// @dev Registers the current contract to OpenSea's operator filter,
    /// and subscribe to the default OpenSea operator blocklist.
    /// Note: Will not revert nor update existing settings for repeated registration.
    function _registerForOperatorFiltering() internal virtual {
        _registerForOperatorFiltering(_DEFAULT_SUBSCRIPTION, true);
    }

    /// @dev Registers the current contract to OpenSea's operator filter.
    /// Note: Will not revert nor update existing settings for repeated registration.
    function _registerForOperatorFiltering(address subscriptionOrRegistrantToCopy, bool subscribe)
        internal
        virtual
    {
        /// @solidity memory-safe-assembly
        assembly {
            let functionSelector := 0x7d3e3dbe // `registerAndSubscribe(address,address)`.

            // Clean the upper 96 bits of `subscriptionOrRegistrantToCopy` in case they are dirty.
            subscriptionOrRegistrantToCopy := shr(96, shl(96, subscriptionOrRegistrantToCopy))
            // prettier-ignore
            for {} iszero(subscribe) {} {
                if iszero(subscriptionOrRegistrantToCopy) {
                    functionSelector := 0x4420e486 // `register(address)`.
                    break
                }
                functionSelector := 0xa0af2903 // `registerAndCopyEntries(address,address)`.
                break
            }
            // Store the function selector.
            mstore(0x00, shl(224, functionSelector))
            // Store the `address(this)`.
            mstore(0x04, address())
            // Store the `subscriptionOrRegistrantToCopy`.
            mstore(0x24, subscriptionOrRegistrantToCopy)
            // Register into the registry.
            pop(call(gas(), _OPERATOR_FILTER_REGISTRY, 0, 0x00, 0x44, 0x00, 0x00))
            // Restore the part of the free memory pointer that was overwritten,
            // which is guaranteed to be zero, because of Solidity's memory size limits.
            mstore(0x24, 0)
        }
    }

    /// @dev Modifier to guard a function and revert if the caller is a blocked operator.
    modifier onlyAllowedOperator(address from) virtual {
        if (from != msg.sender) {
            if (!_isPriorityOperator(msg.sender)) {
                if (_operatorFilteringEnabled()) _revertIfBlocked(msg.sender);
            }
        }
        _;
    }

    /// @dev Modifier to guard a function from approving a blocked operator..
    modifier onlyAllowedOperatorApproval(address operator) virtual {
        if (!_isPriorityOperator(operator)) {
            if (_operatorFilteringEnabled()) _revertIfBlocked(operator);
        }
        _;
    }

    /// @dev Helper function that reverts if the `operator` is blocked by the registry.
    function _revertIfBlocked(address operator) private view {
        /// @solidity memory-safe-assembly
        assembly {
            // Store the function selector of `isOperatorAllowed(address,address)`,
            // shifted left by 6 bytes, which is enough for 8tb of memory.
            // We waste 6-3 = 3 bytes to save on 6 runtime gas (PUSH1 0x224 SHL).
            mstore(0x00, 0xc6171134001122334455)
            // Store the `address(this)`.
            mstore(0x1a, address())
            // Store the `operator`.
            mstore(0x3a, operator)

            // `isOperatorAllowed` always returns true if it does not revert.
            if iszero(staticcall(gas(), _OPERATOR_FILTER_REGISTRY, 0x16, 0x44, 0x00, 0x00)) {
                // Bubble up the revert if the staticcall reverts.
                returndatacopy(0x00, 0x00, returndatasize())
                revert(0x00, returndatasize())
            }

            // We'll skip checking if `from` is inside the blacklist.
            // Even though that can block transferring out of wrapper contracts,
            // we don't want tokens to be stuck.

            // Restore the part of the free memory pointer that was overwritten,
            // which is guaranteed to be zero, if less than 8tb of memory is used.
            mstore(0x3a, 0)
        }
    }

    /// @dev For deriving contracts to override, so that operator filtering
    /// can be turned on / off.
    /// Returns true by default.
    function _operatorFilteringEnabled() internal view virtual returns (bool) {
        return true;
    }

    /// @dev For deriving contracts to override, so that preferred marketplaces can
    /// skip operator filtering, helping users save gas.
    /// Returns false for all inputs by default.
    function _isPriorityOperator(address) internal view virtual returns (bool) {
        return false;
    }
}

File 10 of 17 : ERC721ABv2.sol
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                                                    ████████████████████
//                                                    ████████████████████
//                                                    ████████████████████
//                                                    ████████████████████
//
//
//  █████╗ ███╗   ██╗ ██████╗ ████████╗██╗  ██╗███████╗██████╗ ██████╗ ██╗      ██████╗  ██████╗██╗  ██╗
// ██╔══██╗████╗  ██║██╔═══██╗╚══██╔══╝██║  ██║██╔════╝██╔══██╗██╔══██╗██║     ██╔═══██╗██╔════╝██║ ██╔╝
// ███████║██╔██╗ ██║██║   ██║   ██║   ███████║█████╗  ██████╔╝██████╔╝██║     ██║   ██║██║     █████╔╝
// ██╔══██║██║╚██╗██║██║   ██║   ██║   ██╔══██║██╔══╝  ██╔══██╗██╔══██╗██║     ██║   ██║██║     ██╔═██╗
// ██║  ██║██║ ╚████║╚██████╔╝   ██║   ██║  ██║███████╗██║  ██║██████╔╝███████╗╚██████╔╝╚██████╗██║  ██╗
// ╚═╝  ╚═╝╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚══════╝ ╚═════╝  ╚═════╝╚═╝  ╚═╝
//
/**
 * @title ERC721ABv2
 * @author Anotherblock Technical Team
 * @notice Anotherblock NFT standard
 **/

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

/* Openzeppelin Contract */
import {OwnableUpgradeable} from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';

/* ERC721A Azuki Contract */
import {ERC721AUpgradeable} from 'erc721a-upgradeable/contracts/ERC721AUpgradeable.sol';

/* Opensea Contracts */
import {OperatorFilterer} from 'closedsea/src/OperatorFilterer.sol';

/* Custom Imports */
import {IABDropManager} from './interfaces/IABDropManager.sol';

/// @dev Error thrown when trying to set a drop ID that is already set
error AlreadySet();

/// @dev Error thrown when trying to call a function with an incorrect caller
error UnauthorizedUpdate();

abstract contract ERC721ABv2 is
    ERC721AUpgradeable,
    OperatorFilterer,
    OwnableUpgradeable
{
    //     _____ __        __
    //    / ___// /_____ _/ /____  _____
    //    \__ \/ __/ __ `/ __/ _ \/ ___/
    //   ___/ / /_/ /_/ / /_/  __(__  )
    //  /____/\__/\__,_/\__/\___/____/

    /// @dev AB Drop Manager address
    address public dropManager;

    /// @dev Drop Identifier
    uint256 public dropId;

    /// @dev Drop ID set enable flag
    bool public locked;

    /// @dev Opensea Registry filter enable flag
    bool public operatorFilteringEnabled;

    //     ______                 __                  __
    //    / ____/___  ____  _____/ /________  _______/ /_____  _____
    //   / /   / __ \/ __ \/ ___/ __/ ___/ / / / ___/ __/ __ \/ ___/
    //  / /___/ /_/ / / / (__  ) /_/ /  / /_/ / /__/ /_/ /_/ / /
    //  \____/\____/_/ /_/____/\__/_/   \__,_/\___/\__/\____/_/

    /**
     * @notice
     *  ERC721AB contract initializer
     *
     * @param _dropManager : Drop Manager contract address
     * @param _name : name of the NFT contract
     * @param _symbol : symbol / ticker of the NFT contract
     **/
    function __ERC721ABv2_init(
        address _dropManager,
        string memory _name,
        string memory _symbol
    ) internal initializerERC721A initializer {
        __ERC721A_init(_name, _symbol);
        __Ownable_init();
        _registerForOperatorFiltering();
        dropManager = _dropManager;
        locked = false;
        operatorFilteringEnabled = true;
    }

    //     ______     __                        __   ______                 __  _
    //    / ____/  __/ /____  _________  ____ _/ /  / ____/_  ______  _____/ /_(_)___  ____  _____
    //   / __/ | |/_/ __/ _ \/ ___/ __ \/ __ `/ /  / /_  / / / / __ \/ ___/ __/ / __ \/ __ \/ ___/
    //  / /____>  </ /_/  __/ /  / / / / /_/ / /  / __/ / /_/ / / / / /__/ /_/ / /_/ / / / (__  )
    // /_____/_/|_|\__/\___/_/  /_/ /_/\__,_/_/  /_/    \__,_/_/ /_/\___/\__/_/\____/_/ /_/____/

    /**
     * @notice
     *  Set the `_dropId`
     *
     * @param _dropId drop identifer to be set to
     */
    function setDropId(uint256 _dropId) external {
        if (msg.sender != dropManager) revert UnauthorizedUpdate();
        if (locked) revert AlreadySet();
        locked = true;
        dropId = _dropId;
    }

    /**
     * @notice
     *  Approve or remove `operator` as an operator for the caller.
     *
     * @param _operator the address to be approved to transfer the token
     * @param _approved the approval status to be set
     */
    function setApprovalForAll(
        address _operator,
        bool _approved
    ) public override onlyAllowedOperatorApproval(_operator) {
        super.setApprovalForAll(_operator, _approved);
    }

    /**
     * @notice
     *  Gives permission to `_operator` to transfer `tokenId` token to another account. See {ERC721A-_approve}.
     *
     * @param _operator the address to be approved to transfer the token
     * @param _tokenId the token identifier to be approved
     */
    function approve(
        address _operator,
        uint256 _tokenId
    ) public payable override onlyAllowedOperatorApproval(_operator) {
        super.approve(_operator, _tokenId);
    }

    function transferFrom(
        address _from,
        address _to,
        uint256 _tokenId
    ) public payable override onlyAllowedOperator(_from) {
        super.transferFrom(_from, _to, _tokenId);
    }

    function safeTransferFrom(
        address _from,
        address _to,
        uint256 _tokenId
    ) public payable override onlyAllowedOperator(_from) {
        super.safeTransferFrom(_from, _to, _tokenId);
    }

    function safeTransferFrom(
        address _from,
        address _to,
        uint256 _tokenId,
        bytes memory _data
    ) public payable override onlyAllowedOperator(_from) {
        super.safeTransferFrom(_from, _to, _tokenId, _data);
    }

    //
    //     ____        __         ____
    //    / __ \____  / /_  __   / __ \_      ______  ___  _____
    //   / / / / __ \/ / / / /  / / / / | /| / / __ \/ _ \/ ___/
    //  / /_/ / / / / / /_/ /  / /_/ /| |/ |/ / / / /  __/ /
    //  \____/_/ /_/_/\__, /   \____/ |__/|__/_/ /_/\___/_/
    //               /____/

    /**
     * @notice
     *  Update dropManager address
     *  Only the contract owner can perform this operation
     *
     * @param _dropManager : new dropManager address
     */
    function setDropManager(address _dropManager) external onlyOwner {
        dropManager = _dropManager;
    }

    function setOperatorFilteringEnabled(bool value) public onlyOwner {
        operatorFilteringEnabled = value;
    }

    //   _    ___                 ______                 __  _
    //  | |  / (_)__ _      __   / ____/_  ______  _____/ /_(_)___  ____  _____
    //  | | / / / _ \ | /| / /  / /_  / / / / __ \/ ___/ __/ / __ \/ __ \/ ___/
    //  | |/ / /  __/ |/ |/ /  / __/ / /_/ / / / / /__/ /_/ / /_/ / / / (__  )
    //  |___/_/\___/|__/|__/  /_/    \__,_/_/ /_/\___/\__/_/\____/_/ /_/____/

    function owner()
        public
        view
        virtual
        override(OwnableUpgradeable)
        returns (address)
    {
        return OwnableUpgradeable.owner();
    }

    //     ____      __                        __   ______                 __  _
    //    /  _/___  / /____  _________  ____ _/ /  / ____/_  ______  _____/ /_(_)___  ____  _____
    //    / // __ \/ __/ _ \/ ___/ __ \/ __ `/ /  / /_  / / / / __ \/ ___/ __/ / __ \/ __ \/ ___/
    //  _/ // / / / /_/  __/ /  / / / / /_/ / /  / __/ / /_/ / / / / /__/ /_/ / /_/ / / / (__  )
    // /___/_/ /_/\__/\___/_/  /_/ /_/\__,_/_/  /_/    \__,_/_/ /_/\___/\__/_/\____/_/ /_/____/

    function _operatorFilteringEnabled()
        internal
        view
        virtual
        override
        returns (bool)
    {
        return operatorFilteringEnabled;
    }

    /**
     * @dev See {ERC721Enumerable-beforeTokenTransfer}.
     */
    function _beforeTokenTransfers(
        address _from,
        address _to,
        uint256 _startTokenId,
        uint256 _quantity
    ) internal override(ERC721AUpgradeable) {
        IABDropManager(dropManager).updateOnTransfer(
            _from,
            _to,
            dropId,
            _quantity
        );
    }
}

File 11 of 17 : ERC721ABErrors.sol
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                                                    ████████████████████
//                                                    ████████████████████
//                                                    ████████████████████
//                                                    ████████████████████
//
//
//  █████╗ ███╗   ██╗ ██████╗ ████████╗██╗  ██╗███████╗██████╗ ██████╗ ██╗      ██████╗  ██████╗██╗  ██╗
// ██╔══██╗████╗  ██║██╔═══██╗╚══██╔══╝██║  ██║██╔════╝██╔══██╗██╔══██╗██║     ██╔═══██╗██╔════╝██║ ██╔╝
// ███████║██╔██╗ ██║██║   ██║   ██║   ███████║█████╗  ██████╔╝██████╔╝██║     ██║   ██║██║     █████╔╝
// ██╔══██║██║╚██╗██║██║   ██║   ██║   ██╔══██║██╔══╝  ██╔══██╗██╔══██╗██║     ██║   ██║██║     ██╔═██╗
// ██║  ██║██║ ╚████║╚██████╔╝   ██║   ██║  ██║███████╗██║  ██║██████╔╝███████╗╚██████╔╝╚██████╗██║  ██╗
// ╚═╝  ╚═╝╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚══════╝ ╚═════╝  ╚═════╝╚═╝  ╚═╝
//
/**
 * @title ERC721ABErrors
 * @author Anotherblock Technical Team
 * @notice ERC721AB Custom Errors contract
 **/

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

contract ERC721ABErrors {
    /**
    @notice Error returned if the drop is sold-out
    **/
    error DropSoldOut();

    /**
    @notice Error returned if the whitelist sale has not started yet
    **/
    error SaleNotStarted();

    /**
    @notice Error returned if user attempt to mint more than allowed by the drop
    **/
    error MaxMintPerAddress();

    /**
    @notice Error returned if the supply is sold out
    **/
    error NotEnoughTokensAvailable();

    /**
    @notice Error returned if user did not send the correct amount of ETH
    **/
    error IncorrectETHSent();

    /**
    @notice Error returned if non-whitelisted user attempts to mint prior to public sale  
    **/
    error NotInMerkle();

    /**
    @notice Error returned if the contract passed as parameters does not implement the expected interface  
    **/
    error IncorrectInterface();

    /**
    @notice Error returned if there are no ETH to withdraw from the contract
    **/
    error NothingToWithdraw();

    /**
    @notice Error returned if the caller is not authorized
    **/
    error Forbidden();

    /**
    @notice Error returned when a ETH transfer failed
    **/
    error TransferFailed();

    /**
    @notice Error returned when a ETH transfer failed
    **/
    error ZeroAddress();

    /**
    @notice Error returned if an uneligible user attempts to mint
    **/
    error NotEligible();

    /**
    @notice Error returned when the requested drop is incorrect
    **/
    error InvalidDrop();
}

File 12 of 17 : IABDropManager.sol
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ██████████████████████████████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                            ████████████████████████          ██████████
//                                                    ████████████████████
//                                                    ████████████████████
//                                                    ████████████████████
//                                                    ████████████████████
//
//
//  █████╗ ███╗   ██╗ ██████╗ ████████╗██╗  ██╗███████╗██████╗ ██████╗ ██╗      ██████╗  ██████╗██╗  ██╗
// ██╔══██╗████╗  ██║██╔═══██╗╚══██╔══╝██║  ██║██╔════╝██╔══██╗██╔══██╗██║     ██╔═══██╗██╔════╝██║ ██╔╝
// ███████║██╔██╗ ██║██║   ██║   ██║   ███████║█████╗  ██████╔╝██████╔╝██║     ██║   ██║██║     █████╔╝
// ██╔══██║██║╚██╗██║██║   ██║   ██║   ██╔══██║██╔══╝  ██╔══██╗██╔══██╗██║     ██║   ██║██║     ██╔═██╗
// ██║  ██║██║ ╚████║╚██████╔╝   ██║   ██║  ██║███████╗██║  ██║██████╔╝███████╗╚██████╔╝╚██████╗██║  ██╗
// ╚═╝  ╚═╝╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚══════╝ ╚═════╝  ╚═════╝╚═╝  ╚═╝
//
/**
 * @title IABDropManager
 * @author Anotherblock Technical Team
 * @notice ABDropManager Interface
 **/

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IABDropManager {
    /**
     * @notice
     *  Drop Structure format
     *
     * @param dropId : drop unique identifier
     * @param sold : total number of sold tokens for this drop (accross all associated tokenId)
     * @param rightHolderFee : right Holder fee on each mint expressed in basis point
     * @param tokenInfo : Token Info struct defining the token information (see TokenInfo structure)
     * @param owner : right holder address
     * @param nft :  NFT contract address
     */
    struct Drop {
        uint256 dropId;
        uint256 sold;
        uint256 rightHolderFee;
        TokenInfo tokenInfo;
        address owner;
        address nft;
    }

    /**
     * @notice
     *  TokenInfo Structure format
     *
     * @param price : initial price in ETH(?) of 1 token
     * @param supply : total number of tokens for this drop (accross all associated tokenId)
     * @param royaltySharePerToken : total percentage of royalty evenly distributed among tokens holders
     */
    struct TokenInfo {
        uint256 price;
        uint256 supply;
        uint256 royaltySharePerToken;
    }

    /**
     * @notice
     *  Returns Anotherblock Treasury address
     *
     */
    function treasury() external view returns (address);

    /**
     * @notice
     *  Returns the drop `_dropId`
     *
     * @param _dropId : drop identifier
     */
    function drops(uint256 _dropId) external view returns (Drop memory);

    /**
     * @notice
     *  Create a Drop
     *  Only the contract owner can perform this operation
     *
     * @param _owner : right holder address
     * @param _nft : NFT contract address
     * @param _price : initial price in ETH of 1 NFT
     * @param _supply : total number of NFT for this drop
     * @param _royaltySharePerToken : total percentage of royalty evenly distributed among NFT holders (to be divided by 1e6)
     * @param _rightHolderFee : right Holder fee on each mint (to be divided by 1e6)
     * @param _baseFlow : base amount of AB Token to be streamed per seconds
     */
    function create(
        address _owner,
        address _nft,
        uint256 _price,
        uint256 _supply,
        uint256 _royaltySharePerToken,
        uint256 _rightHolderFee,
        int96 _baseFlow
    ) external;

    function updateDropCounter(uint256 _dropId, uint256 _quantity) external;

    /**
     * @notice
     *  Relay NFT transfer data to L2 contracts
     *
     * @param _from previous holder address
     * @param _to new holder address
     * @param _dropId drop ID associated to the token transferred
     * @param _quantity amount of token transferred
     */
    function updateOnTransfer(
        address _from,
        address _to,
        uint256 _dropId,
        uint256 _quantity
    ) external;

    /**
     * @notice
     *  Update the treasury address
     *  Only the contract owner can perform this operation
     *
     * @param _newTreasury : new treasury address
     */
    function setTreasury(address _newTreasury) external;

    /**
     * @notice
     *  Update the Drop `_dropId` drop information
     *  Only the contract owner can perform this operation
     *
     * @param _dropId :  drop identifier of the drop to be updated
     * @param _rightHolderFee : fees paid to right holder
     * @param _owner : right holder address
     */
    function setRightHolderInfo(
        uint256 _dropId,
        uint256 _rightHolderFee,
        address _owner
    ) external;

    /**
     * @notice
     *  Update the Drop `_dropId` token information
     *  Only the contract owner can perform this operation
     *
     *  Return true if `tokenCount` and `supply` are updated, false otherwise
     *
     * @param _dropId :  drop identifier of the drop to be updated
     * @param _tokenInfo : array containing the new informations to be updated
     */
    function setTokenInfo(
        uint256 _dropId,
        uint256[3] calldata _tokenInfo
    ) external returns (bool);
}

File 13 of 17 : ERC721A__Initializable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable diamond facet contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */

import {ERC721A__InitializableStorage} from './ERC721A__InitializableStorage.sol';

abstract contract ERC721A__Initializable {
    using ERC721A__InitializableStorage for ERC721A__InitializableStorage.Layout;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializerERC721A() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(
            ERC721A__InitializableStorage.layout()._initializing
                ? _isConstructor()
                : !ERC721A__InitializableStorage.layout()._initialized,
            'ERC721A__Initializable: contract is already initialized'
        );

        bool isTopLevelCall = !ERC721A__InitializableStorage.layout()._initializing;
        if (isTopLevelCall) {
            ERC721A__InitializableStorage.layout()._initializing = true;
            ERC721A__InitializableStorage.layout()._initialized = true;
        }

        _;

        if (isTopLevelCall) {
            ERC721A__InitializableStorage.layout()._initializing = false;
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} modifier, directly or indirectly.
     */
    modifier onlyInitializingERC721A() {
        require(
            ERC721A__InitializableStorage.layout()._initializing,
            'ERC721A__Initializable: contract is not initializing'
        );
        _;
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        // extcodesize checks the size of the code stored in an address, and
        // address returns the current address. Since the code is still not
        // deployed when running a constructor, any checks on its code size will
        // yield zero, making it an effective way to detect if a contract is
        // under construction or not.
        address self = address(this);
        uint256 cs;
        assembly {
            cs := extcodesize(self)
        }
        return cs == 0;
    }
}

File 14 of 17 : ERC721A__InitializableStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base storage for the  initialization function for upgradeable diamond facet contracts
 **/

library ERC721A__InitializableStorage {
    struct Layout {
        /*
         * Indicates that the contract has been initialized.
         */
        bool _initialized;
        /*
         * Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.initializable.facet');

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly {
            l.slot := slot
        }
    }
}

File 15 of 17 : ERC721AStorage.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

library ERC721AStorage {
    // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
    struct TokenApprovalRef {
        address value;
    }

    struct Layout {
        // =============================================================
        //                            STORAGE
        // =============================================================

        // The next token ID to be minted.
        uint256 _currentIndex;
        // The number of tokens burned.
        uint256 _burnCounter;
        // Token name
        string _name;
        // Token symbol
        string _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) _packedOwnerships;
        // Mapping owner address to address data.
        //
        // Bits Layout:
        // - [0..63]    `balance`
        // - [64..127]  `numberMinted`
        // - [128..191] `numberBurned`
        // - [192..255] `aux`
        mapping(address => uint256) _packedAddressData;
        // Mapping from token ID to approved address.
        mapping(uint256 => ERC721AStorage.TokenApprovalRef) _tokenApprovals;
        // Mapping from owner to operator approvals
        mapping(address => mapping(address => bool)) _operatorApprovals;
    }

    bytes32 internal constant STORAGE_SLOT = keccak256('ERC721A.contracts.storage.ERC721A');

    function layout() internal pure returns (Layout storage l) {
        bytes32 slot = STORAGE_SLOT;
        assembly {
            l.slot := slot
        }
    }
}

File 16 of 17 : ERC721AUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721AUpgradeable.sol';
import {ERC721AStorage} from './ERC721AStorage.sol';
import './ERC721A__Initializable.sol';

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

/**
 * @title ERC721A
 *
 * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
 * Non-Fungible Token Standard, including the Metadata extension.
 * Optimized for lower gas during batch mints.
 *
 * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
 * starting from `_startTokenId()`.
 *
 * Assumptions:
 *
 * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721AUpgradeable is ERC721A__Initializable, IERC721AUpgradeable {
    using ERC721AStorage for ERC721AStorage.Layout;

    // =============================================================
    //                           CONSTANTS
    // =============================================================

    // 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 `Transfer` event signature is given by:
    // `keccak256(bytes("Transfer(address,address,uint256)"))`.
    bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;

    // =============================================================
    //                          CONSTRUCTOR
    // =============================================================

    function __ERC721A_init(string memory name_, string memory symbol_) internal onlyInitializingERC721A {
        __ERC721A_init_unchained(name_, symbol_);
    }

    function __ERC721A_init_unchained(string memory name_, string memory symbol_) internal onlyInitializingERC721A {
        ERC721AStorage.layout()._name = name_;
        ERC721AStorage.layout()._symbol = symbol_;
        ERC721AStorage.layout()._currentIndex = _startTokenId();
    }

    // =============================================================
    //                   TOKEN COUNTING OPERATIONS
    // =============================================================

    /**
     * @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 virtual returns (uint256) {
        return ERC721AStorage.layout()._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 virtual override returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than `_currentIndex - _startTokenId()` times.
        unchecked {
            return ERC721AStorage.layout()._currentIndex - ERC721AStorage.layout()._burnCounter - _startTokenId();
        }
    }

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

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

    // =============================================================
    //                    ADDRESS DATA OPERATIONS
    // =============================================================

    /**
     * @dev Returns the number of tokens in `owner`'s account.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return ERC721AStorage.layout()._packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        return
            (ERC721AStorage.layout()._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
            (ERC721AStorage.layout()._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(ERC721AStorage.layout()._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 virtual {
        uint256 packed = ERC721AStorage.layout()._packedAddressData[owner];
        uint256 auxCasted;
        // Cast `aux` with assembly to avoid redundant masking.
        assembly {
            auxCasted := aux
        }
        packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
        ERC721AStorage.layout()._packedAddressData[owner] = packed;
    }

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    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: [ERC165](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.
    }

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

    /**
     * @dev Returns the token collection name.
     */
    function name() public view virtual override returns (string memory) {
        return ERC721AStorage.layout()._name;
    }

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() public view virtual override returns (string memory) {
        return ERC721AStorage.layout()._symbol;
    }

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    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 '';
    }

    // =============================================================
    //                     OWNERSHIPS OPERATIONS
    // =============================================================

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        return address(uint160(_packedOwnershipOf(tokenId)));
    }

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

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

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

    /**
     * Returns the packed ownership data of `tokenId`.
     */
    function _packedOwnershipOf(uint256 tokenId) private view returns (uint256 packed) {
        if (_startTokenId() <= tokenId) {
            packed = ERC721AStorage.layout()._packedOwnerships[tokenId];
            // If not burned.
            if (packed & _BITMASK_BURNED == 0) {
                // If the data at the starting slot does not exist, start the scan.
                if (packed == 0) {
                    if (tokenId >= ERC721AStorage.layout()._currentIndex) revert OwnerQueryForNonexistentToken();
                    // Invariant:
                    // There will always be an initialized ownership slot
                    // (i.e. `ownership.addr != address(0) && ownership.burned == false`)
                    // before an unintialized ownership slot
                    // (i.e. `ownership.addr == address(0) && ownership.burned == false`)
                    // Hence, `tokenId` will not underflow.
                    //
                    // We can directly compare the packed value.
                    // If the address is zero, packed will be zero.
                    for (;;) {
                        unchecked {
                            packed = ERC721AStorage.layout()._packedOwnerships[--tokenId];
                        }
                        if (packed == 0) continue;
                        return packed;
                    }
                }
                // Otherwise, the data exists and is not burned. We can skip the scan.
                // This is possible because we have already achieved the target condition.
                // This saves 2143 gas on transfers of initialized tokens.
                return packed;
            }
        }
        revert OwnerQueryForNonexistentToken();
    }

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

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

    // =============================================================
    //                      APPROVAL OPERATIONS
    // =============================================================

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account. See {ERC721A-_approve}.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     */
    function approve(address to, uint256 tokenId) public payable virtual override {
        _approve(to, tokenId, true);
    }

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return ERC721AStorage.layout()._tokenApprovals[tokenId].value;
    }

    /**
     * @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) public virtual override {
        ERC721AStorage.layout()._operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return ERC721AStorage.layout()._operatorApprovals[owner][operator];
    }

    /**
     * @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. See {_mint}.
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return
            _startTokenId() <= tokenId &&
            tokenId < ERC721AStorage.layout()._currentIndex && // If within bounds,
            ERC721AStorage.layout()._packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
    }

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

    /**
     * @dev Returns the storage slot and value for the approved address of `tokenId`.
     */
    function _getApprovedSlotAndAddress(uint256 tokenId)
        private
        view
        returns (uint256 approvedAddressSlot, address approvedAddress)
    {
        ERC721AStorage.TokenApprovalRef storage tokenApproval = ERC721AStorage.layout()._tokenApprovals[tokenId];
        // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`.
        assembly {
            approvedAddressSlot := tokenApproval.slot
            approvedAddress := sload(approvedAddressSlot)
        }
    }

    // =============================================================
    //                      TRANSFER OPERATIONS
    // =============================================================

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * 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
    ) public payable virtual override {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

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

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

        // The nested ifs save around 20+ gas over a compound boolean condition.
        if (!_isSenderApprovedOrOwner(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.
            --ERC721AStorage.layout()._packedAddressData[from]; // Updates: `balance -= 1`.
            ++ERC721AStorage.layout()._packedAddressData[to]; // Updates: `balance += 1`.

            // Updates:
            // - `address` to the next owner.
            // - `startTimestamp` to the timestamp of transfering.
            // - `burned` to `false`.
            // - `nextInitialized` to `true`.
            ERC721AStorage.layout()._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 (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != ERC721AStorage.layout()._currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        ERC721AStorage.layout()._packedOwnerships[nextTokenId] = prevOwnershipPacked;
                    }
                }
            }
        }

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

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable virtual override {
        safeTransferFrom(from, to, tokenId, '');
    }

    /**
     * @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 memory _data
    ) public payable virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

    /**
     * @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 Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
     *
     * `from` - Previous owner of the given token ID.
     * `to` - Target address that will receive the token.
     * `tokenId` - Token ID to be transferred.
     * `_data` - Optional data to send along with the call.
     *
     * Returns 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__IERC721ReceiverUpgradeable(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data)
        returns (bytes4 retval) {
            return retval == ERC721A__IERC721ReceiverUpgradeable(to).onERC721Received.selector;
        } catch (bytes memory reason) {
            if (reason.length == 0) {
                revert TransferToNonERC721ReceiverImplementer();
            } else {
                assembly {
                    revert(add(32, reason), mload(reason))
                }
            }
        }
    }

    // =============================================================
    //                        MINT OPERATIONS
    // =============================================================

    /**
     * @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 virtual {
        uint256 startTokenId = ERC721AStorage.layout()._currentIndex;
        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`.
            ERC721AStorage.layout()._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`.
            ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

            uint256 toMasked;
            uint256 end = startTokenId + quantity;

            // Use assembly to loop and emit the `Transfer` event for gas savings.
            // The duplicated `log4` removes an extra check and reduces stack juggling.
            // The assembly, together with the surrounding Solidity code, have been
            // delicately arranged to nudge the compiler into producing optimized opcodes.
            assembly {
                // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
                toMasked := and(to, _BITMASK_ADDRESS)
                // Emit the `Transfer` event.
                log4(
                    0, // Start of data (0, since no data).
                    0, // End of data (0, since no data).
                    _TRANSFER_EVENT_SIGNATURE, // Signature.
                    0, // `address(0)`.
                    toMasked, // `to`.
                    startTokenId // `tokenId`.
                )

                // The `iszero(eq(,))` check ensures that large values of `quantity`
                // that overflows uint256 will make the loop run out of gas.
                // The compiler will optimize the `iszero` away for performance.
                for {
                    let tokenId := add(startTokenId, 1)
                } iszero(eq(tokenId, end)) {
                    tokenId := add(tokenId, 1)
                } {
                    // Emit the `Transfer` event. Similar to above.
                    log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
                }
            }
            if (toMasked == 0) revert MintToZeroAddress();

            ERC721AStorage.layout()._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 virtual {
        uint256 startTokenId = ERC721AStorage.layout()._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`.
            ERC721AStorage.layout()._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`.
            ERC721AStorage.layout()._packedOwnerships[startTokenId] = _packOwnershipData(
                to,
                _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
            );

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

            ERC721AStorage.layout()._currentIndex = startTokenId + quantity;
        }
        _afterTokenTransfers(address(0), to, startTokenId, 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 virtual {
        _mint(to, quantity);

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

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

    // =============================================================
    //                       APPROVAL OPERATIONS
    // =============================================================

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

    /**
     * @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:
     *
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function _approve(
        address to,
        uint256 tokenId,
        bool approvalCheck
    ) internal virtual {
        address owner = ownerOf(tokenId);

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

        ERC721AStorage.layout()._tokenApprovals[tokenId].value = to;
        emit Approval(owner, to, tokenId);
    }

    // =============================================================
    //                        BURN OPERATIONS
    // =============================================================

    /**
     * @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) = _getApprovedSlotAndAddress(tokenId);

        if (approvalCheck) {
            // The nested ifs save around 20+ gas over a compound boolean condition.
            if (!_isSenderApprovedOrOwner(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;`.
            ERC721AStorage.layout()._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`.
            ERC721AStorage.layout()._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 (ERC721AStorage.layout()._packedOwnerships[nextTokenId] == 0) {
                    // If the next slot is within bounds.
                    if (nextTokenId != ERC721AStorage.layout()._currentIndex) {
                        // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
                        ERC721AStorage.layout()._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 {
            ERC721AStorage.layout()._burnCounter++;
        }
    }

    // =============================================================
    //                     EXTRA DATA OPERATIONS
    // =============================================================

    /**
     * @dev Directly sets the extra data for the ownership data `index`.
     */
    function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
        uint256 packed = ERC721AStorage.layout()._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);
        ERC721AStorage.layout()._packedOwnerships[index] = packed;
    }

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

    // =============================================================
    //                       OTHER OPERATIONS
    // =============================================================

    /**
     * @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 virtual returns (string memory str) {
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit), but
            // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 word for the trailing zeros padding, 1 word for the length,
            // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0.
            let m := add(mload(0x40), 0xa0)
            // Update the free memory pointer to allocate.
            mstore(0x40, m)
            // Assign the `str` to the end.
            str := sub(m, 0x20)
            // Zeroize the slot after the string.
            mstore(str, 0)

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

            // We write the string from rightmost digit to leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            // prettier-ignore
            for { let temp := value } 1 {} {
                str := sub(str, 1)
                // Write the character to the pointer.
                // The ASCII index of the '0' character is 48.
                mstore8(str, add(48, mod(temp, 10)))
                // Keep dividing `temp` until zero.
                temp := div(temp, 10)
                // prettier-ignore
                if iszero(temp) { break }
            }

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

File 17 of 17 : IERC721AUpgradeable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

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

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

    /**
     * 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();

    // =============================================================
    //                            STRUCTS
    // =============================================================

    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Stores 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 via {_extraData}.
        uint24 extraData;
    }

    // =============================================================
    //                         TOKEN COUNTERS
    // =============================================================

    /**
     * @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() external view returns (uint256);

    // =============================================================
    //                            IERC165
    // =============================================================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 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`,
     * 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,
        bytes calldata data
    ) external payable;

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external payable;

    /**
     * @dev Transfers `tokenId` 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 payable;

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

    /**
     * @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](https://eips.ethereum.org/EIPS/eip-2309) standard.
     *
     * See {_mintERC2309} for more details.
     */
    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"AlreadySet","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"DropSoldOut","type":"error"},{"inputs":[],"name":"Forbidden","type":"error"},{"inputs":[],"name":"IncorrectETHSent","type":"error"},{"inputs":[],"name":"IncorrectInterface","type":"error"},{"inputs":[],"name":"InvalidDrop","type":"error"},{"inputs":[],"name":"MaxMintPerAddress","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NotEligible","type":"error"},{"inputs":[],"name":"NotEnoughTokensAvailable","type":"error"},{"inputs":[],"name":"NotInMerkle","type":"error"},{"inputs":[],"name":"NothingToWithdraw","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"SaleNotStarted","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"UnauthorizedUpdate","type":"error"},{"inputs":[],"name":"ZeroAddress","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":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_dropId","type":"uint256"}],"name":"UpdatedPhase","type":"event"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dropId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dropManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"genesisMinted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"address","name":"_dropManager","type":"address"},{"internalType":"address","name":"_abPFP","type":"address"},{"internalType":"string","name":"_baseUri","type":"string"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"mintAllowlist","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_anothercollector","type":"address"}],"name":"mintGenesis","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"}],"name":"mintPfpHolder","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"mintPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mintedPerAddress","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":"operatorFilteringEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"","type":"uint256"}],"name":"phasesPerDrop","outputs":[{"internalType":"uint256","name":"phaseStart","type":"uint256"},{"internalType":"uint256","name":"maxMint","type":"uint256"},{"internalType":"bytes32","name":"merkle","type":"bytes32"}],"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":"payable","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":"payable","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":"_newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_dropId","type":"uint256"}],"name":"setDropId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_dropManager","type":"address"}],"name":"setDropManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"phaseStart","type":"uint256"},{"internalType":"uint256","name":"maxMint","type":"uint256"},{"internalType":"bytes32","name":"merkle","type":"bytes32"}],"internalType":"struct ABDrop5.Phase[4]","name":"_phases","type":"tuple[4]"}],"name":"setDropPhases","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"value","type":"bool"}],"name":"setOperatorFilteringEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawToRightholder","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50613085806100206000396000f3fe60806040526004361061019f5760003560e01c806301ffc9a7146101a457806306fdde03146101d9578063081812fc146101fb578063095ea7b314610228578063153de1431461023d57806318160ddd1461025e57806320a8755a1461028157806323b872dd146102a15780632a778c9b146102b457806342842e0e146102ca5780634571e3a6146102dd57806355f804b3146102fd578063592d36241461031d5780635b592fd1146103585780636352211e1461037857806370a0823114610398578063715018a6146103b8578063853828b6146103cd5780638c70fdc1146103e25780638da5cb5b146103f55780638f53bc9e1461040a578063940203921461042a57806395d89b411461043d5780639f93f77914610452578063a22cb46514610465578063b70f420514610485578063b7c0b8e8146104a5578063b88d4fde146104c5578063c87b56dd146104d8578063cc5dfcba146104f8578063cf3090121461050b578063d445b97814610525578063e985e9c514610552578063f0acbe8914610572578063f2fde38b14610592578063fb796e6c146105b2575b600080fd5b3480156101b057600080fd5b506101c46101bf366004612544565b6105d1565b60405190151581526020015b60405180910390f35b3480156101e557600080fd5b506101ee610623565b6040516101d091906125b1565b34801561020757600080fd5b5061021b6102163660046125c4565b6106be565b6040516101d091906125dd565b61023b610236366004612606565b61070b565b005b34801561024957600080fd5b506076546101c490600160a01b900460ff1681565b34801561026a57600080fd5b50610273610731565b6040519081526020016101d0565b34801561028d57600080fd5b5061023b61029c366004612632565b610751565b61023b6102af36600461264f565b61077b565b3480156102c057600080fd5b5061027360665481565b61023b6102d836600461264f565b6107b3565b3480156102e957600080fd5b5061023b6102f8366004612799565b6107e5565b34801561030957600080fd5b5061023b61031836600461280e565b6109ef565b34801561032957600080fd5b5061033d6103383660046125c4565b610a04565b604080519384526020840192909252908201526060016101d0565b34801561036457600080fd5b5061023b61037336600461287f565b610a2b565b34801561038457600080fd5b5061021b6103933660046125c4565b610ac6565b3480156103a457600080fd5b506102736103b3366004612632565b610ad1565b3480156103c457600080fd5b5061023b610b39565b3480156103d957600080fd5b5061023b610b4d565b61023b6103f0366004612911565b610c37565b34801561040157600080fd5b5061021b610fbf565b34801561041657600080fd5b5060655461021b906001600160a01b031681565b61023b610438366004612632565b610fd8565b34801561044957600080fd5b506101ee6111cf565b61023b610460366004612606565b6111e7565b34801561047157600080fd5b5061023b6104803660046129e4565b611412565b34801561049157600080fd5b5061023b6104a03660046125c4565b611433565b3480156104b157600080fd5b5061023b6104c0366004612a19565b611554565b61023b6104d3366004612a34565b611576565b3480156104e457600080fd5b506101ee6104f33660046125c4565b6115b0565b61023b610506366004612911565b611634565b34801561051757600080fd5b506067546101c49060ff1681565b34801561053157600080fd5b50610273610540366004612632565b60756020526000908152604090205481565b34801561055e57600080fd5b506101c461056d366004612ab3565b61177a565b34801561057e57600080fd5b5061023b61058d3660046125c4565b6117b7565b34801561059e57600080fd5b5061023b6105ad366004612632565b611818565b3480156105be57600080fd5b506067546101c490610100900460ff1681565b60006301ffc9a760e01b6001600160e01b03198316148061060257506380ac58cd60e01b6001600160e01b03198316145b8061061d5750635b5e139f60e01b6001600160e01b03198316145b92915050565b606061062d61188e565b600201805461063b90612aec565b80601f016020809104026020016040519081016040528092919081815260200182805461066790612aec565b80156106b45780601f10610689576101008083540402835291602001916106b4565b820191906000526020600020905b81548152906001019060200180831161069757829003601f168201915b5050505050905090565b60006106c9826118b2565b6106e6576040516333d1c03960e21b815260040160405180910390fd5b6106ee61188e565b60009283526006016020525060409020546001600160a01b031690565b816107146118fb565b156107225761072281611909565b61072c838361194d565b505050565b6000600161073d61188e565b6001015461074961188e565b540303919050565b61075961195d565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b826001600160a01b03811633146107a2576107946118fb565b156107a2576107a233611909565b6107ad8484846119bc565b50505050565b826001600160a01b03811633146107da576107cc6118fb565b156107da576107da33611909565b6107ad848484611bac565b6107ed611bc7565b54610100900460ff1661080c57610802611bc7565b5460ff1615610810565b303b155b6108355760405162461bcd60e51b815260040161082c90612b26565b60405180910390fd5b600061083f611bc7565b54610100900460ff16159050801561088b57600161085b611bc7565b80549115156101000261ff0019909216919091179055600161087b611bc7565b805460ff19169115159190911790555b600054610100900460ff16158080156108ab5750600054600160ff909116105b806108cc57506108ba30611beb565b1580156108cc575060005460ff166001145b6108e85760405162461bcd60e51b815260040161082c90612b6b565b6000805460ff19166001179055801561090b576000805461ff0019166101001790555b610965856040518060400160405280601a8152602001794269746368204265747465722048617665204d79204d6f6e657960301b8152506040518060400160405280600581526020016444524f503560d81b815250611bfa565b60686109718482612c14565b50607680546001600160a81b0319166001600160a01b03861617905580156109c2576000805461ff001916905560405160018152600080516020613010833981519152906020015b60405180910390a15b5080156107ad5760006109d3611bc7565b80549115156101000261ff001990921691909117905550505050565b6109f761195d565b606861072c828483612ccd565b60698160048110610a1457600080fd5b600302018054600182015460029092015490925083565b610a3361195d565b80518051606955602080820151606a55604091820151606b55808301518051606c5580820151606d55820151606e55818301518051606f55808201516070558201516071556060830151805160725580820151607355820151607455606654825190815291517ffda37b53117c5bf84916ece7449890be93cbd2842914c83f4a6864adb618654f9281900390910190a150565b600061061d82611d8d565b60006001600160a01b038216610afa576040516323d3ad8160e21b815260040160405180910390fd5b6001600160401b03610b0a61188e565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b610b4161195d565b610b4b6000611e3a565b565b610b5561195d565b606554604080516361d027b360e01b815290516000926001600160a01b0316916361d027b39160048083019260209291908290030181865afa158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190612da7565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610c0d576040519150601f19603f3d011682016040523d82523d6000602084013e610c12565b606091505b5050905080610c34576040516312171d8360e31b815260040160405180910390fd5b50565b606554606654604051630bd6732d60e31b81526004810191909152839134916000916001600160a01b031690635eb399689060240161010060405180830381865afa158015610c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cae9190612dc4565b60a08101519091506001600160a01b03163014610cde576040516352c9fb0f60e11b815260040160405180910390fd5b806060015160200151816020015103610d0a576040516306d6b15160e51b815260040160405180910390fd5b806060015160200151838260200151610d239190612e75565b1115610d4257604051632d400a1b60e01b815260040160405180910390fd5b606081015151610d53908490612e88565b8214610d72576040516322790dad60e01b815260040160405180910390fd5b60006069815b60030201604051806060016040529081600082015481526020016001820154815260200160028201548152505090508060000151421015610dcc576040516316851a3760e11b815260040160405180910390fd5b6000610e168683604001518a604051602001610dfb919060609190911b6001600160601b031916815260140190565b60405160208183030381529060405280519060200120611e8c565b905080610e3657604051637c75aa6f60e11b815260040160405180910390fd5b6076546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610e67908c906004016125dd565b602060405180830381865afa158015610e84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea89190612ea7565b60208401519091508115610ec957818460200151610ec69190612e88565b90505b6001600160a01b038a166000908152607560205260409020548190610eef908b90612e75565b1115610f0e576040516369f0a9d960e11b815260040160405180910390fd5b6001600160a01b038a16600090815260756020526040812080548b9290610f36908490612e75565b9091555050606554606654604051632844d0e360e21b81526001600160a01b039092169163a113438c91610f77918d90600401918252602082015260400190565b600060405180830381600087803b158015610f9157600080fd5b505af1158015610fa5573d6000803e3d6000fd5b50505050610fb38a8a611ea2565b50505050505050505050565b6000610fd36033546001600160a01b031690565b905090565b606554606654604051630bd6732d60e31b8152600481019190915260019134916000916001600160a01b031690635eb399689060240161010060405180830381865afa15801561102c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110509190612dc4565b60a08101519091506001600160a01b03163014611080576040516352c9fb0f60e11b815260040160405180910390fd5b8060600151602001518160200151036110ac576040516306d6b15160e51b815260040160405180910390fd5b8060600151602001518382602001516110c59190612e75565b11156110e457604051632d400a1b60e01b815260040160405180910390fd5b6060810151516110f5908490612e88565b8214611114576040516322790dad60e01b815260040160405180910390fd5b61111c61195d565b607654600160a01b900460ff161561114757604051631dd2188d60e31b815260040160405180910390fd5b606554606654604051632844d0e360e21b81526004810191909152600160248201526001600160a01b039091169063a113438c90604401600060405180830381600087803b15801561119857600080fd5b505af11580156111ac573d6000803e3d6000fd5b50506076805460ff60a01b1916600160a01b179055506107ad9050846001611ea2565b60606111d961188e565b600301805461063b90612aec565b606554606654604051630bd6732d60e31b81526004810191909152829134916000916001600160a01b031690635eb399689060240161010060405180830381865afa15801561123a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125e9190612dc4565b60a08101519091506001600160a01b0316301461128e576040516352c9fb0f60e11b815260040160405180910390fd5b8060600151602001518160200151036112ba576040516306d6b15160e51b815260040160405180910390fd5b8060600151602001518382602001516112d39190612e75565b11156112f257604051632d400a1b60e01b815260040160405180910390fd5b606081015151611303908490612e88565b8214611322576040516322790dad60e01b815260040160405180910390fd5b60408051606081018252606f5480825260705460208301526071549282019290925290421015611365576040516316851a3760e11b815260040160405180910390fd5b6001600160a01b0386166000908152607560205260408120805487929061138d908490612e75565b9091555050606554606654604051632844d0e360e21b81526001600160a01b039092169163a113438c916113ce918990600401918252602082015260400190565b600060405180830381600087803b1580156113e857600080fd5b505af11580156113fc573d6000803e3d6000fd5b5050505061140a8686611ea2565b505050505050565b8161141b6118fb565b156114295761142981611909565b61072c8383611fc5565b61143b61195d565b606554606654604051630bd6732d60e31b815260048101919091526000916001600160a01b031690635eb399689060240161010060405180830381865afa15801561148a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ae9190612dc4565b60808101519091506001600160a01b03166114dc5760405163d92e233d60e01b815260040160405180910390fd5b600081608001516001600160a01b03168360405160006040518083038185875af1925050503d806000811461152d576040519150601f19603f3d011682016040523d82523d6000602084013e611532565b606091505b505090508061072c576040516312171d8360e31b815260040160405180910390fd5b61155c61195d565b606780549115156101000261ff0019909216919091179055565b836001600160a01b038116331461159d5761158f6118fb565b1561159d5761159d33611909565b6115a985858585612042565b5050505050565b60606115bb826118b2565b6115d857604051630a14c4b560e41b815260040160405180910390fd5b60006115e2612086565b90508051600003611602576040518060200160405280600081525061162d565b8061160c84612095565b60405160200161161d929190612ec0565b6040516020818303038152906040525b9392505050565b606554606654604051630bd6732d60e31b81526004810191909152839134916000916001600160a01b031690635eb399689060240161010060405180830381865afa158015611687573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ab9190612dc4565b60a08101519091506001600160a01b031630146116db576040516352c9fb0f60e11b815260040160405180910390fd5b806060015160200151816020015103611707576040516306d6b15160e51b815260040160405180910390fd5b8060600151602001518382602001516117209190612e75565b111561173f57604051632d400a1b60e01b815260040160405180910390fd5b606081015151611750908490612e88565b821461176f576040516322790dad60e01b815260040160405180910390fd5b600060696001610d78565b600061178461188e565b6001600160a01b039384166000908152600791909101602090815260408083209490951682529290925250205460ff1690565b6065546001600160a01b031633146117e257604051634f1f214760e01b815260040160405180910390fd5b60675460ff16156118065760405163a741a04560e01b815260040160405180910390fd5b6067805460ff19166001179055606655565b61182061195d565b6001600160a01b0381166118855760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161082c565b610c3481611e3a565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b6000816001111580156118cc57506118c861188e565b5482105b801561061d5750600160e01b6118e061188e565b60008481526004919091016020526040902054161592915050565b606754610100900460ff1690565b69c617113400112233445560005230601a5280603a52600080604460166daaeb6d7670e522a718067333cd4e5afa611945573d6000803e3d6000fd5b6000603a5250565b611959828260016120d9565b5050565b33611966610fbf565b6001600160a01b031614610b4b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161082c565b60006119c782611d8d565b9050836001600160a01b0316816001600160a01b0316146119fa5760405162a1148160e81b815260040160405180910390fd5b600080611a068461218e565b91509150611a2b8187611a163390565b6001600160a01b039081169116811491141790565b611a5657611a39863361177a565b611a5657604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516611a7d57604051633a954ecd60e21b815260040160405180910390fd5b611a8a86868660016121b6565b8015611a9557600082555b611a9d61188e565b6001600160a01b0387166000908152600591909101602052604090208054600019019055611ac961188e565b6001600160a01b03861660009081526005919091016020526040902080546001019055611afa85600160e11b612234565b611b0261188e565b60008681526004919091016020526040812091909155600160e11b84169003611b785760018401611b3161188e565b600082815260049190910160205260408120549003611b7657611b5261188e565b548114611b765783611b6261188e565b600083815260049190910160205260409020555b505b83856001600160a01b0316876001600160a01b031660008051602061303083398151915260405160405180910390a461140a565b61072c83838360405180602001604052806000815250611576565b7fee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85f90565b6001600160a01b03163b151590565b611c02611bc7565b54610100900460ff16611c2157611c17611bc7565b5460ff1615611c25565b303b155b611c415760405162461bcd60e51b815260040161082c90612b26565b6000611c4b611bc7565b54610100900460ff161590508015611c97576001611c67611bc7565b80549115156101000261ff00199092169190911790556001611c87611bc7565b805460ff19169115159190911790555b600054610100900460ff1615808015611cb75750600054600160ff909116105b80611cd85750611cc630611beb565b158015611cd8575060005460ff166001145b611cf45760405162461bcd60e51b815260040161082c90612b6b565b6000805460ff191660011790558015611d17576000805461ff0019166101001790555b611d218484612249565b611d29612280565b611d316122af565b606580546001600160a01b0387166001600160a01b03199091161790556067805461ffff191661010017905580156109c2576000805461ff001916905560405160018152600080516020613010833981519152906020016109b9565b600081600111611e2157611d9f61188e565b600083815260049190910160205260408120549150600160e01b82169003611e215780600003611e1c57611dd161188e565b548210611df157604051636f96cda160e11b815260040160405180910390fd5b611df961188e565b600019909201600081815260049390930160205260409092205490508015611df1575b919050565b604051636f96cda160e11b815260040160405180910390fd5b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600082611e9985846122ce565b14949350505050565b6000611eac61188e565b5490506000829003611ed15760405163b562e8dd60e01b815260040160405180910390fd5b611ede60008483856121b6565b6001600160401b018202611ef061188e565b6001600160a01b0385166000908152600591909101602052604090208054919091019055611f24836001841460e11b612234565b611f2c61188e565b600083815260049190910160205260408120919091556001600160a01b0384169083830190839083906000805160206130308339815191528180a4600183015b818114611f925780836000600080516020613030833981519152600080a4600101611f6c565b5081600003611fb357604051622e076360e81b815260040160405180910390fd5b80611fbc61188e565b555061072c9050565b80611fce61188e565b336000818152600792909201602090815260408084206001600160a01b03881680865290835293819020805460ff19169515159590951790945592518415158152919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61204d84848461077b565b6001600160a01b0383163b156107ad576120698484848461231b565b6107ad576040516368d2bf6b60e11b815260040160405180910390fd5b60606068805461063b90612aec565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806120af5750819003601f19909101908152919050565b60006120e483610ac6565b9050811561212357336001600160a01b0382161461212357612106813361177a565b612123576040516367d9dca160e11b815260040160405180910390fd5b8361212c61188e565b6000858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b600080600061219b61188e565b60009485526006016020525050604090912080549092909150565b6065546066546040516315545f0360e31b81526001600160a01b038781166004830152868116602483015260448201929092526064810184905291169063aaa2f81890608401600060405180830381600087803b15801561221657600080fd5b505af115801561222a573d6000803e3d6000fd5b5050505050505050565b4260a01b176001600160a01b03919091161790565b612251611bc7565b54610100900460ff166122765760405162461bcd60e51b815260040161082c90612eef565b6119598282612406565b600054610100900460ff166122a75760405162461bcd60e51b815260040161082c90612f31565b610b4b612472565b610b4b733cc6cdda760b79bafa08df41ecfa224f810dceb660016124a2565b600081815b8451811015612313576122ff828683815181106122f2576122f2612d86565b6020026020010151612502565b91508061230b81612f7c565b9150506122d3565b509392505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612350903390899088908890600401612f95565b6020604051808303816000875af192505050801561238b575060408051601f3d908101601f1916820190925261238891810190612fd2565b60015b6123e9573d8080156123b9576040519150601f19603f3d011682016040523d82523d6000602084013e6123be565b606091505b5080516000036123e1576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b61240e611bc7565b54610100900460ff166124335760405162461bcd60e51b815260040161082c90612eef565b8161243c61188e565b6002019061244a9082612c14565b508061245461188e565b600301906124629082612c14565b50600161246d61188e565b555050565b600054610100900460ff166124995760405162461bcd60e51b815260040161082c90612f31565b610b4b33611e3a565b6001600160a01b0390911690637d3e3dbe816124cf57826124c85750634420e4866124cf565b5063a0af29035b8060e01b60005250306004528160245260008060446000806daaeb6d7670e522a718067333cd4e5af15060006024525050565b600081831061251e57600082815260208490526040902061162d565b5060009182526020526040902090565b6001600160e01b031981168114610c3457600080fd5b60006020828403121561255657600080fd5b813561162d8161252e565b60005b8381101561257c578181015183820152602001612564565b50506000910152565b6000815180845261259d816020860160208601612561565b601f01601f19169290920160200192915050565b60208152600061162d6020830184612585565b6000602082840312156125d657600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114610c3457600080fd5b6000806040838503121561261957600080fd5b8235612624816125f1565b946020939093013593505050565b60006020828403121561264457600080fd5b813561162d816125f1565b60008060006060848603121561266457600080fd5b833561266f816125f1565b9250602084013561267f816125f1565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156126c8576126c8612690565b60405290565b604051606081016001600160401b03811182821017156126c8576126c8612690565b60405160c081016001600160401b03811182821017156126c8576126c8612690565b604051601f8201601f191681016001600160401b038111828210171561273a5761273a612690565b604052919050565b60006001600160401b0383111561275b5761275b612690565b61276e601f8401601f1916602001612712565b905082815283838301111561278257600080fd5b828260208301376000602084830101529392505050565b6000806000606084860312156127ae57600080fd5b83356127b9816125f1565b925060208401356127c9816125f1565b915060408401356001600160401b038111156127e457600080fd5b8401601f810186136127f557600080fd5b61280486823560208401612742565b9150509250925092565b6000806020838503121561282157600080fd5b82356001600160401b038082111561283857600080fd5b818501915085601f83011261284c57600080fd5b81358181111561285b57600080fd5b86602082850101111561286d57600080fd5b60209290920196919550909350505050565b600061018080838503121561289357600080fd5b83601f8401126128a257600080fd5b6128aa6126a6565b9083019080858311156128bc57600080fd5b845b8381101561290757606081880312156128d75760008081fd5b6128df6126ce565b81358152602080830135818301526040808401359083015290845292909201916060016128be565b5095945050505050565b60008060006060848603121561292657600080fd5b8335612931816125f1565b9250602084810135925060408501356001600160401b038082111561295557600080fd5b818701915087601f83011261296957600080fd5b81358181111561297b5761297b612690565b8060051b915061298c848301612712565b818152918301840191848101908a8411156129a657600080fd5b938501935b838510156129c4578435825293850193908501906129ab565b8096505050505050509250925092565b80358015158114611e1c57600080fd5b600080604083850312156129f757600080fd5b8235612a02816125f1565b9150612a10602084016129d4565b90509250929050565b600060208284031215612a2b57600080fd5b61162d826129d4565b60008060008060808587031215612a4a57600080fd5b8435612a55816125f1565b93506020850135612a65816125f1565b92506040850135915060608501356001600160401b03811115612a8757600080fd5b8501601f81018713612a9857600080fd5b612aa787823560208401612742565b91505092959194509250565b60008060408385031215612ac657600080fd5b8235612ad1816125f1565b91506020830135612ae1816125f1565b809150509250929050565b600181811c90821680612b0057607f821691505b602082108103612b2057634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252603790820152600080516020612ff0833981519152604082015276081a5cc8185b1c9958591e481a5b9a5d1a585b1a5e9959604a1b606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b601f82111561072c57600081815260208120601f850160051c81016020861015612be05750805b601f850160051c820191505b8181101561140a57828155600101612bec565b600019600383901b1c191660019190911b1790565b81516001600160401b03811115612c2d57612c2d612690565b612c4181612c3b8454612aec565b84612bb9565b602080601f831160018114612c705760008415612c5e5750858301515b612c688582612bff565b86555061140a565b600085815260208120601f198616915b82811015612c9f57888601518255948401946001909101908401612c80565b5085821015612cbd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160401b03831115612ce457612ce4612690565b612cf883612cf28354612aec565b83612bb9565b6000601f841160018114612d265760008515612d145750838201355b612d1e8682612bff565b8455506115a9565b600083815260209020601f19861690835b82811015612d575786850135825560209485019460019092019101612d37565b5086821015612d745760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052603260045260246000fd5b8051611e1c816125f1565b600060208284031215612db957600080fd5b815161162d816125f1565b6000818303610100811215612dd857600080fd5b612de06126f0565b8351815260208401516020820152604084015160408201526060605f1983011215612e0a57600080fd5b612e126126ce565b9150606084015182526080840151602083015260a08401516040830152816060820152612e4160c08501612d9c565b6080820152612e5260e08501612d9c565b60a0820152949350505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561061d5761061d612e5f565b6000816000190483118215151615612ea257612ea2612e5f565b500290565b600060208284031215612eb957600080fd5b5051919050565b60008351612ed2818460208801612561565b835190830190612ee6818360208801612561565b01949350505050565b6020808252603490820152600080516020612ff0833981519152604082015273206973206e6f7420696e697469616c697a696e6760601b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060018201612f8e57612f8e612e5f565b5060010190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612fc890830184612585565b9695505050505050565b600060208284031215612fe457600080fd5b815161162d8161252e56fe455243373231415f5f496e697469616c697a61626c653a20636f6e74726163747f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212206ed06a24ad8edfe47e0f882977a6c8c9eb685e1af801459a7f2f9a657ce5b9d064736f6c63430008100033

Deployed Bytecode

0x60806040526004361061019f5760003560e01c806301ffc9a7146101a457806306fdde03146101d9578063081812fc146101fb578063095ea7b314610228578063153de1431461023d57806318160ddd1461025e57806320a8755a1461028157806323b872dd146102a15780632a778c9b146102b457806342842e0e146102ca5780634571e3a6146102dd57806355f804b3146102fd578063592d36241461031d5780635b592fd1146103585780636352211e1461037857806370a0823114610398578063715018a6146103b8578063853828b6146103cd5780638c70fdc1146103e25780638da5cb5b146103f55780638f53bc9e1461040a578063940203921461042a57806395d89b411461043d5780639f93f77914610452578063a22cb46514610465578063b70f420514610485578063b7c0b8e8146104a5578063b88d4fde146104c5578063c87b56dd146104d8578063cc5dfcba146104f8578063cf3090121461050b578063d445b97814610525578063e985e9c514610552578063f0acbe8914610572578063f2fde38b14610592578063fb796e6c146105b2575b600080fd5b3480156101b057600080fd5b506101c46101bf366004612544565b6105d1565b60405190151581526020015b60405180910390f35b3480156101e557600080fd5b506101ee610623565b6040516101d091906125b1565b34801561020757600080fd5b5061021b6102163660046125c4565b6106be565b6040516101d091906125dd565b61023b610236366004612606565b61070b565b005b34801561024957600080fd5b506076546101c490600160a01b900460ff1681565b34801561026a57600080fd5b50610273610731565b6040519081526020016101d0565b34801561028d57600080fd5b5061023b61029c366004612632565b610751565b61023b6102af36600461264f565b61077b565b3480156102c057600080fd5b5061027360665481565b61023b6102d836600461264f565b6107b3565b3480156102e957600080fd5b5061023b6102f8366004612799565b6107e5565b34801561030957600080fd5b5061023b61031836600461280e565b6109ef565b34801561032957600080fd5b5061033d6103383660046125c4565b610a04565b604080519384526020840192909252908201526060016101d0565b34801561036457600080fd5b5061023b61037336600461287f565b610a2b565b34801561038457600080fd5b5061021b6103933660046125c4565b610ac6565b3480156103a457600080fd5b506102736103b3366004612632565b610ad1565b3480156103c457600080fd5b5061023b610b39565b3480156103d957600080fd5b5061023b610b4d565b61023b6103f0366004612911565b610c37565b34801561040157600080fd5b5061021b610fbf565b34801561041657600080fd5b5060655461021b906001600160a01b031681565b61023b610438366004612632565b610fd8565b34801561044957600080fd5b506101ee6111cf565b61023b610460366004612606565b6111e7565b34801561047157600080fd5b5061023b6104803660046129e4565b611412565b34801561049157600080fd5b5061023b6104a03660046125c4565b611433565b3480156104b157600080fd5b5061023b6104c0366004612a19565b611554565b61023b6104d3366004612a34565b611576565b3480156104e457600080fd5b506101ee6104f33660046125c4565b6115b0565b61023b610506366004612911565b611634565b34801561051757600080fd5b506067546101c49060ff1681565b34801561053157600080fd5b50610273610540366004612632565b60756020526000908152604090205481565b34801561055e57600080fd5b506101c461056d366004612ab3565b61177a565b34801561057e57600080fd5b5061023b61058d3660046125c4565b6117b7565b34801561059e57600080fd5b5061023b6105ad366004612632565b611818565b3480156105be57600080fd5b506067546101c490610100900460ff1681565b60006301ffc9a760e01b6001600160e01b03198316148061060257506380ac58cd60e01b6001600160e01b03198316145b8061061d5750635b5e139f60e01b6001600160e01b03198316145b92915050565b606061062d61188e565b600201805461063b90612aec565b80601f016020809104026020016040519081016040528092919081815260200182805461066790612aec565b80156106b45780601f10610689576101008083540402835291602001916106b4565b820191906000526020600020905b81548152906001019060200180831161069757829003601f168201915b5050505050905090565b60006106c9826118b2565b6106e6576040516333d1c03960e21b815260040160405180910390fd5b6106ee61188e565b60009283526006016020525060409020546001600160a01b031690565b816107146118fb565b156107225761072281611909565b61072c838361194d565b505050565b6000600161073d61188e565b6001015461074961188e565b540303919050565b61075961195d565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b826001600160a01b03811633146107a2576107946118fb565b156107a2576107a233611909565b6107ad8484846119bc565b50505050565b826001600160a01b03811633146107da576107cc6118fb565b156107da576107da33611909565b6107ad848484611bac565b6107ed611bc7565b54610100900460ff1661080c57610802611bc7565b5460ff1615610810565b303b155b6108355760405162461bcd60e51b815260040161082c90612b26565b60405180910390fd5b600061083f611bc7565b54610100900460ff16159050801561088b57600161085b611bc7565b80549115156101000261ff0019909216919091179055600161087b611bc7565b805460ff19169115159190911790555b600054610100900460ff16158080156108ab5750600054600160ff909116105b806108cc57506108ba30611beb565b1580156108cc575060005460ff166001145b6108e85760405162461bcd60e51b815260040161082c90612b6b565b6000805460ff19166001179055801561090b576000805461ff0019166101001790555b610965856040518060400160405280601a8152602001794269746368204265747465722048617665204d79204d6f6e657960301b8152506040518060400160405280600581526020016444524f503560d81b815250611bfa565b60686109718482612c14565b50607680546001600160a81b0319166001600160a01b03861617905580156109c2576000805461ff001916905560405160018152600080516020613010833981519152906020015b60405180910390a15b5080156107ad5760006109d3611bc7565b80549115156101000261ff001990921691909117905550505050565b6109f761195d565b606861072c828483612ccd565b60698160048110610a1457600080fd5b600302018054600182015460029092015490925083565b610a3361195d565b80518051606955602080820151606a55604091820151606b55808301518051606c5580820151606d55820151606e55818301518051606f55808201516070558201516071556060830151805160725580820151607355820151607455606654825190815291517ffda37b53117c5bf84916ece7449890be93cbd2842914c83f4a6864adb618654f9281900390910190a150565b600061061d82611d8d565b60006001600160a01b038216610afa576040516323d3ad8160e21b815260040160405180910390fd5b6001600160401b03610b0a61188e565b6005016000846001600160a01b03166001600160a01b0316815260200190815260200160002054169050919050565b610b4161195d565b610b4b6000611e3a565b565b610b5561195d565b606554604080516361d027b360e01b815290516000926001600160a01b0316916361d027b39160048083019260209291908290030181865afa158015610b9f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bc39190612da7565b6001600160a01b03164760405160006040518083038185875af1925050503d8060008114610c0d576040519150601f19603f3d011682016040523d82523d6000602084013e610c12565b606091505b5050905080610c34576040516312171d8360e31b815260040160405180910390fd5b50565b606554606654604051630bd6732d60e31b81526004810191909152839134916000916001600160a01b031690635eb399689060240161010060405180830381865afa158015610c8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cae9190612dc4565b60a08101519091506001600160a01b03163014610cde576040516352c9fb0f60e11b815260040160405180910390fd5b806060015160200151816020015103610d0a576040516306d6b15160e51b815260040160405180910390fd5b806060015160200151838260200151610d239190612e75565b1115610d4257604051632d400a1b60e01b815260040160405180910390fd5b606081015151610d53908490612e88565b8214610d72576040516322790dad60e01b815260040160405180910390fd5b60006069815b60030201604051806060016040529081600082015481526020016001820154815260200160028201548152505090508060000151421015610dcc576040516316851a3760e11b815260040160405180910390fd5b6000610e168683604001518a604051602001610dfb919060609190911b6001600160601b031916815260140190565b60405160208183030381529060405280519060200120611e8c565b905080610e3657604051637c75aa6f60e11b815260040160405180910390fd5b6076546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610e67908c906004016125dd565b602060405180830381865afa158015610e84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea89190612ea7565b60208401519091508115610ec957818460200151610ec69190612e88565b90505b6001600160a01b038a166000908152607560205260409020548190610eef908b90612e75565b1115610f0e576040516369f0a9d960e11b815260040160405180910390fd5b6001600160a01b038a16600090815260756020526040812080548b9290610f36908490612e75565b9091555050606554606654604051632844d0e360e21b81526001600160a01b039092169163a113438c91610f77918d90600401918252602082015260400190565b600060405180830381600087803b158015610f9157600080fd5b505af1158015610fa5573d6000803e3d6000fd5b50505050610fb38a8a611ea2565b50505050505050505050565b6000610fd36033546001600160a01b031690565b905090565b606554606654604051630bd6732d60e31b8152600481019190915260019134916000916001600160a01b031690635eb399689060240161010060405180830381865afa15801561102c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110509190612dc4565b60a08101519091506001600160a01b03163014611080576040516352c9fb0f60e11b815260040160405180910390fd5b8060600151602001518160200151036110ac576040516306d6b15160e51b815260040160405180910390fd5b8060600151602001518382602001516110c59190612e75565b11156110e457604051632d400a1b60e01b815260040160405180910390fd5b6060810151516110f5908490612e88565b8214611114576040516322790dad60e01b815260040160405180910390fd5b61111c61195d565b607654600160a01b900460ff161561114757604051631dd2188d60e31b815260040160405180910390fd5b606554606654604051632844d0e360e21b81526004810191909152600160248201526001600160a01b039091169063a113438c90604401600060405180830381600087803b15801561119857600080fd5b505af11580156111ac573d6000803e3d6000fd5b50506076805460ff60a01b1916600160a01b179055506107ad9050846001611ea2565b60606111d961188e565b600301805461063b90612aec565b606554606654604051630bd6732d60e31b81526004810191909152829134916000916001600160a01b031690635eb399689060240161010060405180830381865afa15801561123a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125e9190612dc4565b60a08101519091506001600160a01b0316301461128e576040516352c9fb0f60e11b815260040160405180910390fd5b8060600151602001518160200151036112ba576040516306d6b15160e51b815260040160405180910390fd5b8060600151602001518382602001516112d39190612e75565b11156112f257604051632d400a1b60e01b815260040160405180910390fd5b606081015151611303908490612e88565b8214611322576040516322790dad60e01b815260040160405180910390fd5b60408051606081018252606f5480825260705460208301526071549282019290925290421015611365576040516316851a3760e11b815260040160405180910390fd5b6001600160a01b0386166000908152607560205260408120805487929061138d908490612e75565b9091555050606554606654604051632844d0e360e21b81526001600160a01b039092169163a113438c916113ce918990600401918252602082015260400190565b600060405180830381600087803b1580156113e857600080fd5b505af11580156113fc573d6000803e3d6000fd5b5050505061140a8686611ea2565b505050505050565b8161141b6118fb565b156114295761142981611909565b61072c8383611fc5565b61143b61195d565b606554606654604051630bd6732d60e31b815260048101919091526000916001600160a01b031690635eb399689060240161010060405180830381865afa15801561148a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ae9190612dc4565b60808101519091506001600160a01b03166114dc5760405163d92e233d60e01b815260040160405180910390fd5b600081608001516001600160a01b03168360405160006040518083038185875af1925050503d806000811461152d576040519150601f19603f3d011682016040523d82523d6000602084013e611532565b606091505b505090508061072c576040516312171d8360e31b815260040160405180910390fd5b61155c61195d565b606780549115156101000261ff0019909216919091179055565b836001600160a01b038116331461159d5761158f6118fb565b1561159d5761159d33611909565b6115a985858585612042565b5050505050565b60606115bb826118b2565b6115d857604051630a14c4b560e41b815260040160405180910390fd5b60006115e2612086565b90508051600003611602576040518060200160405280600081525061162d565b8061160c84612095565b60405160200161161d929190612ec0565b6040516020818303038152906040525b9392505050565b606554606654604051630bd6732d60e31b81526004810191909152839134916000916001600160a01b031690635eb399689060240161010060405180830381865afa158015611687573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ab9190612dc4565b60a08101519091506001600160a01b031630146116db576040516352c9fb0f60e11b815260040160405180910390fd5b806060015160200151816020015103611707576040516306d6b15160e51b815260040160405180910390fd5b8060600151602001518382602001516117209190612e75565b111561173f57604051632d400a1b60e01b815260040160405180910390fd5b606081015151611750908490612e88565b821461176f576040516322790dad60e01b815260040160405180910390fd5b600060696001610d78565b600061178461188e565b6001600160a01b039384166000908152600791909101602090815260408083209490951682529290925250205460ff1690565b6065546001600160a01b031633146117e257604051634f1f214760e01b815260040160405180910390fd5b60675460ff16156118065760405163a741a04560e01b815260040160405180910390fd5b6067805460ff19166001179055606655565b61182061195d565b6001600160a01b0381166118855760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161082c565b610c3481611e3a565b7f2569078dfb4b0305704d3008e7403993ae9601b85f7ae5e742de3de8f8011c4090565b6000816001111580156118cc57506118c861188e565b5482105b801561061d5750600160e01b6118e061188e565b60008481526004919091016020526040902054161592915050565b606754610100900460ff1690565b69c617113400112233445560005230601a5280603a52600080604460166daaeb6d7670e522a718067333cd4e5afa611945573d6000803e3d6000fd5b6000603a5250565b611959828260016120d9565b5050565b33611966610fbf565b6001600160a01b031614610b4b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161082c565b60006119c782611d8d565b9050836001600160a01b0316816001600160a01b0316146119fa5760405162a1148160e81b815260040160405180910390fd5b600080611a068461218e565b91509150611a2b8187611a163390565b6001600160a01b039081169116811491141790565b611a5657611a39863361177a565b611a5657604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516611a7d57604051633a954ecd60e21b815260040160405180910390fd5b611a8a86868660016121b6565b8015611a9557600082555b611a9d61188e565b6001600160a01b0387166000908152600591909101602052604090208054600019019055611ac961188e565b6001600160a01b03861660009081526005919091016020526040902080546001019055611afa85600160e11b612234565b611b0261188e565b60008681526004919091016020526040812091909155600160e11b84169003611b785760018401611b3161188e565b600082815260049190910160205260408120549003611b7657611b5261188e565b548114611b765783611b6261188e565b600083815260049190910160205260409020555b505b83856001600160a01b0316876001600160a01b031660008051602061303083398151915260405160405180910390a461140a565b61072c83838360405180602001604052806000815250611576565b7fee151c8401928dc223602bb187aff91b9a56c7cae5476ef1b3287b085a16c85f90565b6001600160a01b03163b151590565b611c02611bc7565b54610100900460ff16611c2157611c17611bc7565b5460ff1615611c25565b303b155b611c415760405162461bcd60e51b815260040161082c90612b26565b6000611c4b611bc7565b54610100900460ff161590508015611c97576001611c67611bc7565b80549115156101000261ff00199092169190911790556001611c87611bc7565b805460ff19169115159190911790555b600054610100900460ff1615808015611cb75750600054600160ff909116105b80611cd85750611cc630611beb565b158015611cd8575060005460ff166001145b611cf45760405162461bcd60e51b815260040161082c90612b6b565b6000805460ff191660011790558015611d17576000805461ff0019166101001790555b611d218484612249565b611d29612280565b611d316122af565b606580546001600160a01b0387166001600160a01b03199091161790556067805461ffff191661010017905580156109c2576000805461ff001916905560405160018152600080516020613010833981519152906020016109b9565b600081600111611e2157611d9f61188e565b600083815260049190910160205260408120549150600160e01b82169003611e215780600003611e1c57611dd161188e565b548210611df157604051636f96cda160e11b815260040160405180910390fd5b611df961188e565b600019909201600081815260049390930160205260409092205490508015611df1575b919050565b604051636f96cda160e11b815260040160405180910390fd5b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600082611e9985846122ce565b14949350505050565b6000611eac61188e565b5490506000829003611ed15760405163b562e8dd60e01b815260040160405180910390fd5b611ede60008483856121b6565b6001600160401b018202611ef061188e565b6001600160a01b0385166000908152600591909101602052604090208054919091019055611f24836001841460e11b612234565b611f2c61188e565b600083815260049190910160205260408120919091556001600160a01b0384169083830190839083906000805160206130308339815191528180a4600183015b818114611f925780836000600080516020613030833981519152600080a4600101611f6c565b5081600003611fb357604051622e076360e81b815260040160405180910390fd5b80611fbc61188e565b555061072c9050565b80611fce61188e565b336000818152600792909201602090815260408084206001600160a01b03881680865290835293819020805460ff19169515159590951790945592518415158152919290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61204d84848461077b565b6001600160a01b0383163b156107ad576120698484848461231b565b6107ad576040516368d2bf6b60e11b815260040160405180910390fd5b60606068805461063b90612aec565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806120af5750819003601f19909101908152919050565b60006120e483610ac6565b9050811561212357336001600160a01b0382161461212357612106813361177a565b612123576040516367d9dca160e11b815260040160405180910390fd5b8361212c61188e565b6000858152600691909101602052604080822080546001600160a01b0319166001600160a01b0394851617905551859287811692908516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259190a450505050565b600080600061219b61188e565b60009485526006016020525050604090912080549092909150565b6065546066546040516315545f0360e31b81526001600160a01b038781166004830152868116602483015260448201929092526064810184905291169063aaa2f81890608401600060405180830381600087803b15801561221657600080fd5b505af115801561222a573d6000803e3d6000fd5b5050505050505050565b4260a01b176001600160a01b03919091161790565b612251611bc7565b54610100900460ff166122765760405162461bcd60e51b815260040161082c90612eef565b6119598282612406565b600054610100900460ff166122a75760405162461bcd60e51b815260040161082c90612f31565b610b4b612472565b610b4b733cc6cdda760b79bafa08df41ecfa224f810dceb660016124a2565b600081815b8451811015612313576122ff828683815181106122f2576122f2612d86565b6020026020010151612502565b91508061230b81612f7c565b9150506122d3565b509392505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290612350903390899088908890600401612f95565b6020604051808303816000875af192505050801561238b575060408051601f3d908101601f1916820190925261238891810190612fd2565b60015b6123e9573d8080156123b9576040519150601f19603f3d011682016040523d82523d6000602084013e6123be565b606091505b5080516000036123e1576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b61240e611bc7565b54610100900460ff166124335760405162461bcd60e51b815260040161082c90612eef565b8161243c61188e565b6002019061244a9082612c14565b508061245461188e565b600301906124629082612c14565b50600161246d61188e565b555050565b600054610100900460ff166124995760405162461bcd60e51b815260040161082c90612f31565b610b4b33611e3a565b6001600160a01b0390911690637d3e3dbe816124cf57826124c85750634420e4866124cf565b5063a0af29035b8060e01b60005250306004528160245260008060446000806daaeb6d7670e522a718067333cd4e5af15060006024525050565b600081831061251e57600082815260208490526040902061162d565b5060009182526020526040902090565b6001600160e01b031981168114610c3457600080fd5b60006020828403121561255657600080fd5b813561162d8161252e565b60005b8381101561257c578181015183820152602001612564565b50506000910152565b6000815180845261259d816020860160208601612561565b601f01601f19169290920160200192915050565b60208152600061162d6020830184612585565b6000602082840312156125d657600080fd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b0381168114610c3457600080fd5b6000806040838503121561261957600080fd5b8235612624816125f1565b946020939093013593505050565b60006020828403121561264457600080fd5b813561162d816125f1565b60008060006060848603121561266457600080fd5b833561266f816125f1565b9250602084013561267f816125f1565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156126c8576126c8612690565b60405290565b604051606081016001600160401b03811182821017156126c8576126c8612690565b60405160c081016001600160401b03811182821017156126c8576126c8612690565b604051601f8201601f191681016001600160401b038111828210171561273a5761273a612690565b604052919050565b60006001600160401b0383111561275b5761275b612690565b61276e601f8401601f1916602001612712565b905082815283838301111561278257600080fd5b828260208301376000602084830101529392505050565b6000806000606084860312156127ae57600080fd5b83356127b9816125f1565b925060208401356127c9816125f1565b915060408401356001600160401b038111156127e457600080fd5b8401601f810186136127f557600080fd5b61280486823560208401612742565b9150509250925092565b6000806020838503121561282157600080fd5b82356001600160401b038082111561283857600080fd5b818501915085601f83011261284c57600080fd5b81358181111561285b57600080fd5b86602082850101111561286d57600080fd5b60209290920196919550909350505050565b600061018080838503121561289357600080fd5b83601f8401126128a257600080fd5b6128aa6126a6565b9083019080858311156128bc57600080fd5b845b8381101561290757606081880312156128d75760008081fd5b6128df6126ce565b81358152602080830135818301526040808401359083015290845292909201916060016128be565b5095945050505050565b60008060006060848603121561292657600080fd5b8335612931816125f1565b9250602084810135925060408501356001600160401b038082111561295557600080fd5b818701915087601f83011261296957600080fd5b81358181111561297b5761297b612690565b8060051b915061298c848301612712565b818152918301840191848101908a8411156129a657600080fd5b938501935b838510156129c4578435825293850193908501906129ab565b8096505050505050509250925092565b80358015158114611e1c57600080fd5b600080604083850312156129f757600080fd5b8235612a02816125f1565b9150612a10602084016129d4565b90509250929050565b600060208284031215612a2b57600080fd5b61162d826129d4565b60008060008060808587031215612a4a57600080fd5b8435612a55816125f1565b93506020850135612a65816125f1565b92506040850135915060608501356001600160401b03811115612a8757600080fd5b8501601f81018713612a9857600080fd5b612aa787823560208401612742565b91505092959194509250565b60008060408385031215612ac657600080fd5b8235612ad1816125f1565b91506020830135612ae1816125f1565b809150509250929050565b600181811c90821680612b0057607f821691505b602082108103612b2057634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252603790820152600080516020612ff0833981519152604082015276081a5cc8185b1c9958591e481a5b9a5d1a585b1a5e9959604a1b606082015260800190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b601f82111561072c57600081815260208120601f850160051c81016020861015612be05750805b601f850160051c820191505b8181101561140a57828155600101612bec565b600019600383901b1c191660019190911b1790565b81516001600160401b03811115612c2d57612c2d612690565b612c4181612c3b8454612aec565b84612bb9565b602080601f831160018114612c705760008415612c5e5750858301515b612c688582612bff565b86555061140a565b600085815260208120601f198616915b82811015612c9f57888601518255948401946001909101908401612c80565b5085821015612cbd5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6001600160401b03831115612ce457612ce4612690565b612cf883612cf28354612aec565b83612bb9565b6000601f841160018114612d265760008515612d145750838201355b612d1e8682612bff565b8455506115a9565b600083815260209020601f19861690835b82811015612d575786850135825560209485019460019092019101612d37565b5086821015612d745760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052603260045260246000fd5b8051611e1c816125f1565b600060208284031215612db957600080fd5b815161162d816125f1565b6000818303610100811215612dd857600080fd5b612de06126f0565b8351815260208401516020820152604084015160408201526060605f1983011215612e0a57600080fd5b612e126126ce565b9150606084015182526080840151602083015260a08401516040830152816060820152612e4160c08501612d9c565b6080820152612e5260e08501612d9c565b60a0820152949350505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561061d5761061d612e5f565b6000816000190483118215151615612ea257612ea2612e5f565b500290565b600060208284031215612eb957600080fd5b5051919050565b60008351612ed2818460208801612561565b835190830190612ee6818360208801612561565b01949350505050565b6020808252603490820152600080516020612ff0833981519152604082015273206973206e6f7420696e697469616c697a696e6760601b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b600060018201612f8e57612f8e612e5f565b5060010190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612fc890830184612585565b9695505050505050565b600060208284031215612fe457600080fd5b815161162d8161252e56fe455243373231415f5f496e697469616c697a61626c653a20636f6e74726163747f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212206ed06a24ad8edfe47e0f882977a6c8c9eb685e1af801459a7f2f9a657ce5b9d064736f6c63430008100033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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