Contract 0xad0B69e01dC4F051e23F247F2EA41dFCBe3a78b1 6

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x86e67d0b1a9cf0aa3811deae44bea93944e77fdde9d9ca69e87caf545b1dd6fd0x60806040180355792022-07-31 12:58:4717 days 18 hrs ago0xb68d649f181bde8a8fee367535a606cc3c09fccd IN  Create: ERC721SimpleSalesCollection0 AVAX0.‍149743825
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC721SimpleSalesCollection

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 6 runs

Other Settings:
default evmVersion, GNU AGPLv3 license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 41 : IRoyaltyOverride.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * Simple EIP2981 reference override implementation
 */
interface IEIP2981RoyaltyOverride is IERC165 {

    event TokenRoyaltyRemoved(uint256 tokenId);
    event TokenRoyaltySet(uint256 tokenId, address recipient, uint16 bps);
    event DefaultRoyaltySet(address recipient, uint16 bps);

    struct TokenRoyalty {
        address recipient;
        uint16 bps;
    }

    struct TokenRoyaltyConfig {
        uint256 tokenId;
        address recipient;
        uint16 bps;
    }

    /**
     * @dev Set per token royalties.  Passing a recipient of address(0) will delete any existing configuration
     */
    function setTokenRoyalties(TokenRoyaltyConfig[] calldata royalties) external;

    /**
     * @dev Get the number of token specific overrides.  Used to enumerate over all configurations
     */
    function getTokenRoyaltiesCount() external view returns(uint256);

    /**
     * @dev Get a token royalty configuration by index.  Use in conjunction with getTokenRoyaltiesCount to get all per token configurations
     */
    function getTokenRoyaltyByIndex(uint256 index) external view returns(TokenRoyaltyConfig memory);

    /**
     * @dev Set a default royalty configuration.  Will be used if no token specific configuration is set
     */
    function setDefaultRoyalty(TokenRoyalty calldata royalty) external;

}

File 2 of 41 : RoyaltyOverrideCore.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "./IRoyaltyOverride.sol";
import "../specs/IEIP2981.sol";

/**
 * Simple EIP2981 reference override implementation
 */
abstract contract EIP2981RoyaltyOverrideCore is IEIP2981, IEIP2981RoyaltyOverride, ERC165 {
    using EnumerableSet for EnumerableSet.UintSet;

    TokenRoyalty public defaultRoyalty;
    mapping(uint256 => TokenRoyalty) private _tokenRoyalties;
    EnumerableSet.UintSet private _tokensWithRoyalties;

    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return interfaceId == type(IEIP2981).interfaceId || interfaceId == type(IEIP2981RoyaltyOverride).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Sets token royalties. When you override this in the implementation contract
     * ensure that you access restrict it to the contract owner or admin
     */
    function _setTokenRoyalties(TokenRoyaltyConfig[] memory royaltyConfigs) internal {
        for (uint i = 0; i < royaltyConfigs.length; i++) {
            TokenRoyaltyConfig memory royaltyConfig = royaltyConfigs[i];
            require(royaltyConfig.bps < 10000, "Invalid bps");
            if (royaltyConfig.recipient == address(0)) {
                delete _tokenRoyalties[royaltyConfig.tokenId];
                _tokensWithRoyalties.remove(royaltyConfig.tokenId);
                emit TokenRoyaltyRemoved(royaltyConfig.tokenId);
            } else {
                _tokenRoyalties[royaltyConfig.tokenId] = TokenRoyalty(royaltyConfig.recipient, royaltyConfig.bps);
                _tokensWithRoyalties.add(royaltyConfig.tokenId);
                emit TokenRoyaltySet(royaltyConfig.tokenId, royaltyConfig.recipient, royaltyConfig.bps);
            }
        }
    }

    /**
     * @dev Sets default royalty. When you override this in the implementation contract
     * ensure that you access restrict it to the contract owner or admin
     */
    function _setDefaultRoyalty(TokenRoyalty memory royalty) internal {
        require(royalty.bps < 10000, "Invalid bps");
        defaultRoyalty = TokenRoyalty(royalty.recipient, royalty.bps);
        emit DefaultRoyaltySet(royalty.recipient, royalty.bps);
    }

    /**
     * @dev See {IEIP2981RoyaltyOverride-getTokenRoyaltiesCount}.
     */
    function getTokenRoyaltiesCount() external override view returns(uint256) {
        return _tokensWithRoyalties.length();
    }

    /**
     * @dev See {IEIP2981RoyaltyOverride-getTokenRoyaltyByIndex}.
     */
    function getTokenRoyaltyByIndex(uint256 index) external override view returns(TokenRoyaltyConfig memory) {
        uint256 tokenId = _tokensWithRoyalties.at(index);
        TokenRoyalty memory royalty = _tokenRoyalties[tokenId];
        return TokenRoyaltyConfig(tokenId, royalty.recipient, royalty.bps);
    }

    /**
     * @dev See {IEIP2981RoyaltyOverride-royaltyInfo}.
     */
    function royaltyInfo(uint256 tokenId, uint256 value) public override view returns (address, uint256) {
        if (_tokenRoyalties[tokenId].recipient != address(0)) {
            return (_tokenRoyalties[tokenId].recipient, value*_tokenRoyalties[tokenId].bps/10000);
        }
        if (defaultRoyalty.recipient != address(0) && defaultRoyalty.bps != 0) {
            return (defaultRoyalty.recipient, value*defaultRoyalty.bps/10000);
        }
        return (address(0), 0);
    }
}

File 3 of 41 : IEIP2981.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * EIP-2981
 */
interface IEIP2981 {
    /**
     * bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
     *
     * => 0x2a55205a = 0x2a55205a
     */
    function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);
}

File 4 of 41 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 5 of 41 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 6 of 41 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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);
    }
}

File 7 of 41 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/Address.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. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = _setInitializedVersion(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.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so 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.
     *
     * 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.
     */
    modifier reinitializer(uint8 version) {
        bool isTopLevelCall = _setInitializedVersion(version);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _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.
     */
    function _disableInitializers() internal virtual {
        _setInitializedVersion(type(uint8).max);
    }

    function _setInitializedVersion(uint8 version) private returns (bool) {
        // 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, and for the lowest level
        // of initializers, because in other contexts the contract may have been reentered.
        if (_initializing) {
            require(
                version == 1 && !Address.isContract(address(this)),
                "Initializable: contract is already initialized"
            );
            return false;
        } else {
            require(_initialized < version, "Initializable: contract is already initialized");
            _initialized = version;
            return true;
        }
    }
}

File 8 of 41 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 9 of 41 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 10 of 41 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

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

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

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @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, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @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.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

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

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * 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, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 11 of 41 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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 be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

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

File 12 of 41 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 13 of 41 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

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

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

File 14 of 41 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

File 16 of 41 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 17 of 41 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 18 of 41 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees 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 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++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = _efficientHash(computedHash, proofElement);
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = _efficientHash(proofElement, computedHash);
            }
        }
        return computedHash;
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

File 19 of 41 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 20 of 41 : ERC165Storage.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol)

pragma solidity ^0.8.0;

import "./ERC165.sol";

/**
 * @dev Storage based implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165Storage is ERC165 {
    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

File 21 of 41 : 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 22 of 41 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

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

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

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

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

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

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

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

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

File 23 of 41 : BitMaps.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/BitMaps.sol)
pragma solidity ^0.8.0;

/**
 * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
 * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
 */
library BitMaps {
    struct BitMap {
        mapping(uint256 => uint256) _data;
    }

    /**
     * @dev Returns whether the bit at `index` is set.
     */
    function get(BitMap storage bitmap, uint256 index) internal view returns (bool) {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        return bitmap._data[bucket] & mask != 0;
    }

    /**
     * @dev Sets the bit at `index` to the boolean `value`.
     */
    function setTo(
        BitMap storage bitmap,
        uint256 index,
        bool value
    ) internal {
        if (value) {
            set(bitmap, index);
        } else {
            unset(bitmap, index);
        }
    }

    /**
     * @dev Sets the bit at `index`.
     */
    function set(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        bitmap._data[bucket] |= mask;
    }

    /**
     * @dev Unsets the bit at `index`.
     */
    function unset(BitMap storage bitmap, uint256 index) internal {
        uint256 bucket = index >> 8;
        uint256 mask = 1 << (index & 0xff);
        bitmap._data[bucket] &= ~mask;
    }
}

File 24 of 41 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

File 25 of 41 : ERC721AutoIdMinterExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "./ERC721CollectionMetadataExtension.sol";

interface IERC721AutoIdMinterExtension {
    function setMaxSupply(uint256 newValue) external;

    function freezeMaxSupply() external;

    function totalSupply() external view returns (uint256);
}

/**
 * @dev Extension to add minting capability with an auto incremented ID for each token and a maximum supply setting.
 */
abstract contract ERC721AutoIdMinterExtension is
    IERC721AutoIdMinterExtension,
    ERC721CollectionMetadataExtension
{
    using SafeMath for uint256;

    uint256 public maxSupply;
    bool public maxSupplyFrozen;

    uint256 internal _currentTokenId = 0;

    function __ERC721AutoIdMinterExtension_init(uint256 _maxSupply)
        internal
        onlyInitializing
    {
        __ERC721AutoIdMinterExtension_init_unchained(_maxSupply);
    }

    function __ERC721AutoIdMinterExtension_init_unchained(uint256 _maxSupply)
        internal
        onlyInitializing
    {
        maxSupply = _maxSupply;

        _registerInterface(type(IERC721AutoIdMinterExtension).interfaceId);
        _registerInterface(type(IERC721).interfaceId);
    }

    /* ADMIN */

    function setMaxSupply(uint256 newValue) 
        public
        virtual
        override 
        onlyOwner 
    {
        require(!maxSupplyFrozen, "FROZEN");
        require(newValue >= totalSupply(), "LOWER_THAN_SUPPLY");
        maxSupply = newValue;
    }

    function freezeMaxSupply() external onlyOwner {
        maxSupplyFrozen = true;
    }

    /* PUBLIC */

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

    /* INTERNAL */

    function _mintTo(address to, uint256 count) internal {
        require(totalSupply() + count <= maxSupply, "EXCEEDS_SUPPLY");

        for (uint256 i = 0; i < count; i++) {
            uint256 newTokenId = _currentTokenId;
            _safeMint(to, newTokenId);
            _incrementTokenId();
        }
    }

    /**
     * Increments the value of _currentTokenId
     */
    function _incrementTokenId() internal {
        _currentTokenId++;
    }
}

File 26 of 41 : ERC721BulkifyExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

interface IERC721BulkifyExtension {
    function transferFromBulk(
        address from,
        address to,
        uint256[] memory tokenIds
    ) external;

    function transferFromBulk(
        address[] memory from,
        address[] memory to,
        uint256[] memory tokenIds
    ) external;
}

/**
 * @dev Extension to add bulk operations to a standard ERC721 contract.
 */
abstract contract ERC721BulkifyExtension is
    IERC721BulkifyExtension,
    Initializable,
    ERC165Storage
{
    function __ERC721BulkifyExtension_init() internal onlyInitializing {
        __ERC721BulkifyExtension_init_unchained();
    }

    function __ERC721BulkifyExtension_init_unchained()
        internal
        onlyInitializing
    {
        _registerInterface(type(IERC721BulkifyExtension).interfaceId);
    }

    /* PUBLIC */

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165Storage)
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }

    /**
     * Useful for when user wants to return tokens to get a refund,
     * or when they want to transfer lots of tokens by paying gas fee only once.
     */
    function transferFromBulk(
        address from,
        address to,
        uint256[] memory tokenIds
    ) public virtual {
        for (uint256 i = 0; i < tokenIds.length; i++) {
            IERC721(address(this)).transferFrom(from, to, tokenIds[i]);
        }
    }

    /**
     * Useful for transferring multiple tokens from/to multiple addresses.
     */
    function transferFromBulk(
        address[] memory from,
        address[] memory to,
        uint256[] memory tokenIds
    ) public virtual {
        require(from.length == to.length, "FROM_TO_LENGTH_MISMATCH");
        require(from.length == tokenIds.length, "FROM_TOKEN_LENGTH_MISMATCH");

        for (uint256 i = 0; i < tokenIds.length; i++) {
            IERC721(address(this)).transferFrom(from[i], to[i], tokenIds[i]);
        }
    }
}

File 27 of 41 : ERC721CollectionMetadataExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";

interface IERC721CollectionMetadataExtension {
    function setContractURI(string memory newValue) external;

    function contractURI() external view returns (string memory);
}

/**
 * @dev Extension to allow configuring contract-level collection metadata URI.
 */
abstract contract ERC721CollectionMetadataExtension is
    Initializable,
    Ownable,
    ERC165Storage,
    ERC721
{
    string private _name;

    string private _symbol;

    string private _contractURI;

    function __ERC721CollectionMetadataExtension_init(
        string memory name_,
        string memory symbol_,
        string memory contractURI_
    ) internal onlyInitializing {
        __ERC721CollectionMetadataExtension_init_unchained(
            name_,
            symbol_,
            contractURI_
        );
    }

    function __ERC721CollectionMetadataExtension_init_unchained(
        string memory name_,
        string memory symbol_,
        string memory contractURI_
    ) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
        _contractURI = contractURI_;

        _registerInterface(
            type(IERC721CollectionMetadataExtension).interfaceId
        );
        _registerInterface(type(IERC721).interfaceId);
        _registerInterface(type(IERC721Metadata).interfaceId);
    }

    /* ADMIN */

    function setContractURI(string memory newValue) external onlyOwner {
        _contractURI = newValue;
    }

    /* PUBLIC */

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165Storage, ERC721)
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }

    function name() public view virtual override returns (string memory) {
        return _name;
    }

    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    function contractURI() public view returns (string memory) {
        return _contractURI;
    }
}

File 28 of 41 : ERC721LockableExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity ^0.8.9;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import "@openzeppelin/contracts/utils/structs/BitMaps.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./ERC721AutoIdMinterExtension.sol";

interface IERC721LockableExtension {
    function locked(uint256 tokenId) external view returns (bool);

    function lock(uint256 tokenId) external;

    function lock(uint256[] calldata tokenIds) external;

    function unlock(uint256 tokenId) external;

    function unlock(uint256[] calldata tokenIds) external;
}

/**
 * @dev Extension to allow locking NFTs, for use-cases like staking, without leaving holders wallet.
 */
abstract contract ERC721LockableExtension is
    IERC721LockableExtension,
    Initializable,
    ERC165Storage,
    ERC721AutoIdMinterExtension,
    ReentrancyGuard
{
    using BitMaps for BitMaps.BitMap;

    BitMaps.BitMap internal lockedTokens;

    function __ERC721LockableExtension_init() internal onlyInitializing {
        __ERC721LockableExtension_init_unchained();
    }

    function __ERC721LockableExtension_init_unchained()
        internal
        onlyInitializing
    {
        _registerInterface(type(IERC721LockableExtension).interfaceId);
    }

    // PUBLIC

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165Storage, ERC721CollectionMetadataExtension)
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }

    /**
     * Returns if a token is locked or not.
     */
    function locked(uint256 tokenId) public view virtual returns (bool) {
        return lockedTokens.get(tokenId);
    }

    function filterUnlocked(uint256[] calldata ticketTokenIds)
        public
        view
        returns (uint256[] memory)
    {
        uint256[] memory unlocked = new uint256[](ticketTokenIds.length);

        for (uint256 i = 0; i < ticketTokenIds.length; i++) {
            if (!locked(ticketTokenIds[i])) {
                unlocked[i] = ticketTokenIds[i];
            }
        }

        return unlocked;
    }

    /* INTERNAL */

    /**
     * At this moment staking is only possible from a certain address (usually a smart contract).
     *
     * This is because in almost all cases you want another contract to perform custom logic on lock and unlock operations,
     * without allowing users to directly unlock their tokens and sell them, for example.
     */
    function _lock(uint256 tokenId) internal virtual {
        require(!lockedTokens.get(tokenId), "LOCKED");
        lockedTokens.set(tokenId);
    }

    function _unlock(uint256 tokenId) internal virtual {
        require(lockedTokens.get(tokenId), "NOT_LOCKED");
        lockedTokens.unset(tokenId);
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override(ERC721) {
        require(!lockedTokens.get(tokenId), "LOCKED");
        super._beforeTokenTransfer(from, to, tokenId);
    }
}

File 29 of 41 : ERC721OwnerMintExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "./ERC721AutoIdMinterExtension.sol";

interface IERC721OwnerMintExtension {
    function mintByOwner(address to, uint256 count) external;
}

/**
 * @dev Extension to allow owner to mint directly without paying.
 */
abstract contract ERC721OwnerMintExtension is
    IERC721OwnerMintExtension,
    Initializable,
    Ownable,
    ERC165Storage,
    ERC721AutoIdMinterExtension
{
    function __ERC721OwnerMintExtension_init() internal onlyInitializing {
        __ERC721OwnerMintExtension_init_unchained();
    }

    function __ERC721OwnerMintExtension_init_unchained()
        internal
        onlyInitializing
    {
        _registerInterface(type(IERC721OwnerMintExtension).interfaceId);
    }

    /* ADMIN */

    function mintByOwner(address to, uint256 count) external onlyOwner {
        _mintTo(to, count);
    }

    /* PUBLIC */

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165Storage, ERC721CollectionMetadataExtension)
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }
}

File 30 of 41 : ERC721PreSaleExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "./ERC721AutoIdMinterExtension.sol";

interface IERC721PreSaleExtension {
    function setPreSalePrice(uint256 newValue) external;

    function setPreSaleMaxMintPerWallet(uint256 newValue) external;

    function setAllowlistMerkleRoot(bytes32 newRoot) external;

    function togglePreSaleStatus(bool isActive) external;

    function onPreSaleAllowList(address minter, bytes32[] calldata proof)
        external
        view
        returns (bool);

    function mintPreSale(uint256 count, bytes32[] calldata proof)
        external
        payable;
}

/**
 * @dev Extension to provide pre-sale capabilities for certain collectors to mint for a specific price.
 */
abstract contract ERC721PreSaleExtension is
    IERC721PreSaleExtension,
    Initializable,
    ERC165Storage,
    ERC721AutoIdMinterExtension,
    ReentrancyGuard
{
    uint256 public preSalePrice;
    uint256 public preSaleMaxMintPerWallet;
    bytes32 public preSaleAllowlistMerkleRoot;
    bool public preSaleStatus;

    mapping(address => uint256) internal preSaleAllowlistClaimed;

    function __ERC721PreSaleExtension_init(
        uint256 _preSalePrice,
        uint256 _preSaleMaxMintPerWallet
    ) internal onlyInitializing {
        __ERC721PreSaleExtension_init_unchained(
            _preSalePrice,
            _preSaleMaxMintPerWallet
        );
    }

    function __ERC721PreSaleExtension_init_unchained(
        uint256 _preSalePrice,
        uint256 _preSaleMaxMintPerWallet
    ) internal onlyInitializing {
        _registerInterface(type(IERC721PreSaleExtension).interfaceId);

        preSalePrice = _preSalePrice;
        preSaleMaxMintPerWallet = _preSaleMaxMintPerWallet;
    }

    /* ADMIN */

    function setPreSalePrice(uint256 newValue) external onlyOwner {
        preSalePrice = newValue;
    }

    function setPreSaleMaxMintPerWallet(uint256 newValue) external onlyOwner {
        preSaleMaxMintPerWallet = newValue;
    }

    function setAllowlistMerkleRoot(bytes32 newRoot) external onlyOwner {
        preSaleAllowlistMerkleRoot = newRoot;
    }

    function togglePreSaleStatus(bool isActive) external onlyOwner {
        preSaleStatus = isActive;
    }

    /* PUBLIC */

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165Storage, ERC721CollectionMetadataExtension)
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }

    function onPreSaleAllowList(address minter, bytes32[] calldata proof)
        external
        view
        returns (bool)
    {
        return
            MerkleProof.verify(
                proof,
                preSaleAllowlistMerkleRoot,
                _generateMerkleLeaf(minter)
            );
    }

    function mintPreSale(uint256 count, bytes32[] calldata proof)
        external
        payable
        nonReentrant
    {
        require(preSaleStatus, "NOT_ACTIVE");

        address to = _msgSender();

        require(
            MerkleProof.verify(
                proof,
                preSaleAllowlistMerkleRoot,
                _generateMerkleLeaf(to)
            ),
            "WRONG_PROOF"
        );
        require(
            preSaleAllowlistClaimed[to] + count <= preSaleMaxMintPerWallet,
            "PRE_SALE_LIMIT"
        );
        require(preSalePrice * count <= msg.value, "INSUFFICIENT_AMOUNT");

        preSaleAllowlistClaimed[to] += count;

        _mintTo(to, count);
    }

    /* INTERNAL */

    function _generateMerkleLeaf(address account)
        internal
        pure
        returns (bytes32)
    {
        return keccak256(abi.encodePacked(account));
    }
}

File 31 of 41 : ERC721PrefixedMetadataExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "./ERC721CollectionMetadataExtension.sol";

interface IERC721PrefixedMetadataExtension {
    function setPlaceholderURI(string memory newValue) external;

    function setTokenURIPrefix(string memory newValue) external;

    function setTokenURISuffix(string memory newValue) external;

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

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

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

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

    function freezeTokenURI() external;
}

/**
 * @dev Extension to allow configuring tokens metadata URI.
 *      In this extension tokens will have a shared token URI prefix,
 *      therefore on tokenURI() token's ID will be appended to the base URI.
 *      It also allows configuring a fallback "placeholder" URI when prefix is not set yet.
 */
abstract contract ERC721PrefixedMetadataExtension is
    IERC721PrefixedMetadataExtension,
    Initializable,
    Ownable,
    ERC165Storage,
    ERC721
{
    string internal _placeholderURI;
    string internal _tokenURIPrefix;
    string internal _tokenURISuffix;

    bool public tokenURIFrozen;

    function __ERC721PrefixedMetadataExtension_init(
        string memory placeholderURI_,
        string memory tokenURIPrefix_
    ) internal onlyInitializing {
        __ERC721PrefixedMetadataExtension_init_unchained(
            placeholderURI_,
            tokenURIPrefix_
        );
    }

    function __ERC721PrefixedMetadataExtension_init_unchained(
        string memory placeholderURI_,
        string memory tokenURIPrefix_
    ) internal onlyInitializing {
        _placeholderURI = placeholderURI_;
        _tokenURIPrefix = tokenURIPrefix_;
        _tokenURISuffix = ".json";

        _registerInterface(type(IERC721PrefixedMetadataExtension).interfaceId);
        _registerInterface(type(IERC721Metadata).interfaceId);
    }

    /* ADMIN */

    function setPlaceholderURI(string memory newValue) external onlyOwner {
        _placeholderURI = newValue;
    }

    function setTokenURIPrefix(string memory newValue) external onlyOwner {
        require(!tokenURIFrozen, "FROZEN");
        _tokenURIPrefix = newValue;
    }

    function setTokenURISuffix(string memory newValue) external onlyOwner {
        require(!tokenURIFrozen, "FROZEN");
        _tokenURISuffix = newValue;
    }

    function freezeTokenURI() external onlyOwner {
        tokenURIFrozen = true;
    }

    /* PUBLIC */

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165Storage, ERC721)
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }

    function placeholderURI() public view returns (string memory) {
        return _placeholderURI;
    }

    function tokenURIPrefix() public view returns (string memory) {
        return _tokenURIPrefix;
    }

    function tokenURISuffix() public view returns (string memory) {
        return _tokenURISuffix;
    }

    function tokenURI(uint256 _tokenId)
        public
        view
        virtual
        override(ERC721, IERC721PrefixedMetadataExtension)
        returns (string memory)
    {
        return
            bytes(_tokenURIPrefix).length > 0
                ? string(
                    abi.encodePacked(
                        _tokenURIPrefix,
                        Strings.toString(_tokenId),
                        _tokenURISuffix
                    )
                )
                : _placeholderURI;
    }
}

File 32 of 41 : ERC721PublicSaleExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "./ERC721AutoIdMinterExtension.sol";

interface IERC721PublicSaleExtension {
    function setPublicSalePrice(uint256 newValue) external;

    function setPublicSaleMaxMintPerTx(uint256 newValue) external;

    function togglePublicSaleStatus(bool isActive) external;

    function mintPublicSale(address to, uint256 count) external payable;
}

/**
 * @dev Extension to provide pre-sale and public-sale capabilities for collectors to mint for a specific price.
 */
abstract contract ERC721PublicSaleExtension is
    IERC721PublicSaleExtension,
    Initializable,
    Ownable,
    ERC165Storage,
    ERC721AutoIdMinterExtension,
    ReentrancyGuard
{
    uint256 public publicSalePrice;
    uint256 public publicSaleMaxMintPerTx;
    bool public publicSaleStatus;

    function __ERC721PublicSaleExtension_init(
        uint256 _publicSalePrice,
        uint256 _publicSaleMaxMintPerTx
    ) internal onlyInitializing {
        __ERC721PublicSaleExtension_init_unchained(
            _publicSalePrice,
            _publicSaleMaxMintPerTx
        );
    }

    function __ERC721PublicSaleExtension_init_unchained(
        uint256 _publicSalePrice,
        uint256 _publicSaleMaxMintPerTx
    ) internal onlyInitializing {
        _registerInterface(type(IERC721PublicSaleExtension).interfaceId);

        publicSalePrice = _publicSalePrice;
        publicSaleMaxMintPerTx = _publicSaleMaxMintPerTx;
    }

    /* ADMIN */

    function setPublicSalePrice(uint256 newValue) external onlyOwner {
        publicSalePrice = newValue;
    }

    function setPublicSaleMaxMintPerTx(uint256 newValue) external onlyOwner {
        publicSaleMaxMintPerTx = newValue;
    }

    function togglePublicSaleStatus(bool isActive) external onlyOwner {
        publicSaleStatus = isActive;
    }

    /* PUBLIC */

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165Storage, ERC721CollectionMetadataExtension)
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }

    function mintPublicSale(address to, uint256 count)
        external
        payable
        nonReentrant
    {
        require(publicSaleStatus, "PUBLIC_SALE_NOT_ACTIVE");
        require(count <= publicSaleMaxMintPerTx, "PUBLIC_SALE_LIMIT");
        require(publicSalePrice * count <= msg.value, "INSUFFICIENT_AMOUNT");

        _mintTo(to, count);
    }
}

File 33 of 41 : ERC721RoleBasedLockableExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity ^0.8.9;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
import "@openzeppelin/contracts/utils/structs/BitMaps.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./ERC721LockableExtension.sol";

interface IERC721RoleBasedLockableExtension {
    function hasRoleBasedLockableExtension() external view returns (bool);
}

/**
 * @dev Extension to allow locking NFTs, for use-cases like staking, without leaving holders wallet, using roles.
 */
abstract contract ERC721RoleBasedLockableExtension is
    IERC721RoleBasedLockableExtension,
    ERC721LockableExtension,
    AccessControl
{
    using BitMaps for BitMaps.BitMap;

    bytes32 public constant LOCKER_ROLE = keccak256("LOCKER_ROLE");

    function __ERC721RoleBasedLockableExtension_init()
        internal
        onlyInitializing
    {
        __ERC721RoleBasedLockableExtension_init_unchained();
    }

    function __ERC721RoleBasedLockableExtension_init_unchained()
        internal
        onlyInitializing
    {
        _registerInterface(type(IERC721RoleBasedLockableExtension).interfaceId);
    }

    // ADMIN

    /**
     * Locks token(s) to effectively lock them, while keeping in the same wallet.
     * This mechanism prevents them from being transferred, yet still will show correct owner.
     */
    function lock(uint256 tokenId) public virtual nonReentrant {
        require(hasRole(LOCKER_ROLE, msg.sender), "NOT_LOCKER_ROLE");
        _lock(tokenId);
    }

    function lock(uint256[] calldata tokenIds) public virtual nonReentrant {
        require(hasRole(LOCKER_ROLE, msg.sender), "NOT_LOCKER_ROLE");

        for (uint256 i = 0; i < tokenIds.length; i++) {
            _lock(tokenIds[i]);
        }
    }

    /**
     * Unlocks locked token(s) to be able to transfer.
     */
    function unlock(uint256 tokenId) public virtual nonReentrant {
        require(hasRole(LOCKER_ROLE, msg.sender), "NOT_LOCKER_ROLE");
        _unlock(tokenId);
    }

    function unlock(uint256[] calldata tokenIds) public virtual nonReentrant {
        require(hasRole(LOCKER_ROLE, msg.sender), "NOT_LOCKER_ROLE");

        for (uint256 i = 0; i < tokenIds.length; i++) {
            _unlock(tokenIds[i]);
        }
    }

    // PUBLIC

    function hasRoleBasedLockableExtension()
        public
        view
        virtual
        returns (bool)
    {
        return true;
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(AccessControl, ERC721LockableExtension)
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }
}

File 34 of 41 : ERC721RoleBasedMintExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "./ERC721AutoIdMinterExtension.sol";

interface IERC721RoleBasedMintExtension {
    function mintByRole(address to, uint256 count) external;
}

/**
 * @dev Extension to allow holders of a OpenZepplin-based role to mint directly.
 */
abstract contract ERC721RoleBasedMintExtension is
    IERC721RoleBasedMintExtension,
    Initializable,
    ERC165Storage,
    ERC721AutoIdMinterExtension,
    AccessControl
{
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

    function __ERC721RoleBasedMintExtension_init(address minter)
        internal
        onlyInitializing
    {
        __ERC721RoleBasedMintExtension_init_unchained(minter);
    }

    function __ERC721RoleBasedMintExtension_init_unchained(address minter)
        internal
        onlyInitializing
    {
        _registerInterface(type(IERC721RoleBasedMintExtension).interfaceId);

        _setupRole(MINTER_ROLE, minter);
    }

    /* ADMIN */

    function mintByRole(address to, uint256 count) external {
        require(hasRole(MINTER_ROLE, _msgSender()), "NOT_MINTER_ROLE");

        _mintTo(to, count);
    }

    /* PUBLIC */

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(
            ERC165Storage,
            AccessControl,
            ERC721CollectionMetadataExtension
        )
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }
}

File 35 of 41 : ERC721RoyaltyExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltyOverride.sol";
import "@manifoldxyz/royalty-registry-solidity/contracts/overrides/RoyaltyOverrideCore.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "../../../misc/rarible/IRoyalties.sol";
import "../../../misc/rarible/LibPart.sol";
import "../../../misc/rarible/LibRoyaltiesV2.sol";

interface IERC721RoyaltyExtension {
    function setTokenRoyalties(
        IEIP2981RoyaltyOverride.TokenRoyaltyConfig[] calldata royaltyConfigs
    ) external;

    function setDefaultRoyalty(
        IEIP2981RoyaltyOverride.TokenRoyalty calldata royalty
    ) external;

    function getRaribleV2Royalties(uint256 id)
        external
        view
        returns (LibPart.Part[] memory result);
}

/**
 * @dev Extension to signal configured royalty to famous marketplaces as well as ERC2981.
 *
 * This extension currently supports Standard ERC2981, Rarible.
 * Note that OpenSea is supported via Flair metadata feature.
 */
abstract contract ERC721RoyaltyExtension is
    IERC721RoyaltyExtension,
    IRoyalties,
    Initializable,
    Ownable,
    ERC165Storage,
    EIP2981RoyaltyOverrideCore
{
    function __ERC721RoyaltyExtension_init(
        address defaultRoyaltyReceiver,
        uint16 defaultRoyaltyBps
    ) internal onlyInitializing {
        __ERC721RoyaltyExtension_init_unchained(
            defaultRoyaltyReceiver,
            defaultRoyaltyBps
        );
    }

    function __ERC721RoyaltyExtension_init_unchained(
        address defaultRoyaltyReceiver,
        uint16 defaultRoyaltyBps
    ) internal onlyInitializing {
        _registerInterface(type(IERC721RoyaltyExtension).interfaceId);
        _registerInterface(type(IEIP2981).interfaceId);
        _registerInterface(type(IEIP2981RoyaltyOverride).interfaceId);
        _registerInterface(LibRoyaltiesV2._INTERFACE_ID_ROYALTIES);

        TokenRoyalty memory royalty = TokenRoyalty(
            defaultRoyaltyReceiver,
            defaultRoyaltyBps
        );

        _setDefaultRoyalty(royalty);
    }

    function setTokenRoyalties(TokenRoyaltyConfig[] calldata royaltyConfigs)
        external
        override(IEIP2981RoyaltyOverride, IERC721RoyaltyExtension)
        onlyOwner
    {
        _setTokenRoyalties(royaltyConfigs);
    }

    function setDefaultRoyalty(TokenRoyalty calldata royalty)
        external
        override(IEIP2981RoyaltyOverride, IERC721RoyaltyExtension)
        onlyOwner
    {
        _setDefaultRoyalty(royalty);
    }

    function getRaribleV2Royalties(uint256 id)
        external
        view
        override(IRoyalties, IERC721RoyaltyExtension)
        returns (LibPart.Part[] memory result)
    {
        result = new LibPart.Part[](1);

        result[0].account = payable(defaultRoyalty.recipient);
        result[0].value = defaultRoyalty.bps;

        id;
        // avoid unused param warning
    }

    /* PUBLIC */

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165Storage, EIP2981RoyaltyOverrideCore)
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }
}

File 36 of 41 : ERC721SimpleSalesCollection.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

import "../../../common/WithdrawExtension.sol";
import "../../../common/meta-transactions/ERC2771ContextOwnable.sol";
import "../extensions/ERC721CollectionMetadataExtension.sol";
import "../extensions/ERC721PrefixedMetadataExtension.sol";
import "../extensions/ERC721AutoIdMinterExtension.sol";
import "../extensions/ERC721OwnerMintExtension.sol";
import "../extensions/ERC721PreSaleExtension.sol";
import "../extensions/ERC721PublicSaleExtension.sol";
import "../extensions/ERC721RoleBasedMintExtension.sol";
import "../extensions/ERC721RoyaltyExtension.sol";
import "../extensions/ERC721RoleBasedLockableExtension.sol";
import "../extensions/ERC721BulkifyExtension.sol";

contract ERC721SimpleSalesCollection is
    Initializable,
    Ownable,
    ERC165Storage,
    WithdrawExtension,
    ERC721PrefixedMetadataExtension,
    ERC721OwnerMintExtension,
    ERC721PreSaleExtension,
    ERC721PublicSaleExtension,
    ERC721RoleBasedMintExtension,
    ERC721RoleBasedLockableExtension,
    ERC721RoyaltyExtension,
    ERC2771ContextOwnable,
    ERC721BulkifyExtension
{
    struct Config {
        string name;
        string symbol;
        string contractURI;
        string placeholderURI;
        string tokenURIPrefix;
        uint256 maxSupply;
        uint256 preSalePrice;
        uint256 preSaleMaxMintPerWallet;
        uint256 publicSalePrice;
        uint256 publicSaleMaxMintPerTx;
        address defaultRoyaltyAddress;
        uint16 defaultRoyaltyBps;
        address proceedsRecipient;
        address trustedForwarder;
    }

    constructor(Config memory config) ERC721(config.name, config.symbol) {
        initialize(config, msg.sender);
    }

    function initialize(Config memory config, address deployer)
        public
        initializer
    {
        _setupRole(DEFAULT_ADMIN_ROLE, deployer);

        _transferOwnership(deployer);

        __WithdrawExtension_init(config.proceedsRecipient, WithdrawMode.ANYONE);
        __ERC721CollectionMetadataExtension_init(
            config.name,
            config.symbol,
            config.contractURI
        );
        __ERC721PrefixedMetadataExtension_init(
            config.placeholderURI,
            config.tokenURIPrefix
        );
        __ERC721AutoIdMinterExtension_init(config.maxSupply);
        __ERC721OwnerMintExtension_init();
        __ERC721RoleBasedMintExtension_init(deployer);
        __ERC721RoleBasedLockableExtension_init();
        __ERC721PreSaleExtension_init_unchained(
            config.preSalePrice,
            config.preSaleMaxMintPerWallet
        );
        __ERC721PublicSaleExtension_init(
            config.publicSalePrice,
            config.publicSaleMaxMintPerTx
        );
        __ERC721RoyaltyExtension_init(
            config.defaultRoyaltyAddress,
            config.defaultRoyaltyBps
        );
        __ERC2771ContextOwnable_init(config.trustedForwarder);
        __ERC721BulkifyExtension_init();
    }

    function _msgSender()
        internal
        view
        virtual
        override(ERC2771ContextOwnable, Context)
        returns (address sender)
    {
        return super._msgSender();
    }

    function _msgData()
        internal
        view
        virtual
        override(ERC2771ContextOwnable, Context)
        returns (bytes calldata)
    {
        return super._msgData();
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override(ERC721, ERC721LockableExtension) {
        return ERC721LockableExtension._beforeTokenTransfer(from, to, tokenId);
    }

    /* PUBLIC */

    function name()
        public
        view
        override(ERC721, ERC721CollectionMetadataExtension)
        returns (string memory)
    {
        return ERC721CollectionMetadataExtension.name();
    }

    function symbol()
        public
        view
        override(ERC721, ERC721CollectionMetadataExtension)
        returns (string memory)
    {
        return ERC721CollectionMetadataExtension.symbol();
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(
            ERC165Storage,
            ERC721PrefixedMetadataExtension,
            ERC721PreSaleExtension,
            ERC721PublicSaleExtension,
            ERC721OwnerMintExtension,
            ERC721RoleBasedMintExtension,
            ERC721RoyaltyExtension,
            ERC721RoleBasedLockableExtension,
            ERC721BulkifyExtension
        )
        returns (bool)
    {
        return ERC165Storage.supportsInterface(interfaceId);
    }

    function tokenURI(uint256 _tokenId)
        public
        view
        virtual
        override(ERC721, ERC721PrefixedMetadataExtension)
        returns (string memory)
    {
        return ERC721PrefixedMetadataExtension.tokenURI(_tokenId);
    }

    function getInfo()
        external
        view
        returns (
            uint256 _maxSupply,
            uint256 _totalSupply,
            uint256 _senderBalance,
            uint256 _preSalePrice,
            uint256 _preSaleMaxMintPerWallet,
            uint256 _preSaleAlreadyClaimed,
            bool _preSaleActive,
            uint256 _publicSalePrice,
            uint256 _publicSaleMaxMintPerTx,
            bool _publicSaleActive
        )
    {
        uint256 balance = 0;

        if (_msgSender() != address(0)) {
            balance = this.balanceOf(_msgSender());
        }

        return (
            maxSupply,
            this.totalSupply(),
            balance,
            preSalePrice,
            preSaleMaxMintPerWallet,
            preSaleAllowlistClaimed[_msgSender()],
            preSaleStatus,
            publicSalePrice,
            publicSaleMaxMintPerTx,
            publicSaleStatus
        );
    }
}

File 37 of 41 : WithdrawExtension.sol
// SPDX-License-Identifier: AGPL-3.0

pragma solidity 0.8.9;

import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";

enum WithdrawMode {
    OWNER,
    RECIPIENT,
    ANYONE,
    NOBODY
}

interface IWithdrawExtension {
    function setWithdrawRecipient(address _withdrawRecipient) external;

    function lockWithdrawRecipient() external;

    function revokeWithdrawPower() external;

    function setWithdrawMode(WithdrawMode _withdrawMode) external;

    function lockWithdrawMode() external;

    function withdraw(
        address[] calldata claimTokens,
        uint256[] calldata amounts
    ) external;
}

abstract contract WithdrawExtension is
    IWithdrawExtension,
    Initializable,
    Ownable,
    ERC165Storage
{
    using Address for address;
    using Address for address payable;

    event WithdrawPowerRevoked();
    event Withdrawn(address[] claimTokens, uint256[] amounts);

    address public withdrawRecipient;
    bool public withdrawRecipientLocked;

    bool public withdrawPowerRevoked;

    WithdrawMode public withdrawMode;
    bool public withdrawModeLocked;

    /* INTERNAL */

    function __WithdrawExtension_init(
        address _withdrawRecipient,
        WithdrawMode _withdrawMode
    ) internal onlyInitializing {
        __WithdrawExtension_init_unchained(_withdrawRecipient, _withdrawMode);
    }

    function __WithdrawExtension_init_unchained(
        address _withdrawRecipient,
        WithdrawMode _withdrawMode
    ) internal onlyInitializing {
        _registerInterface(type(IWithdrawExtension).interfaceId);

        withdrawRecipient = _withdrawRecipient;
        withdrawMode = _withdrawMode;
    }

    /* ADMIN */

    function setWithdrawRecipient(address _withdrawRecipient)
        external
        onlyOwner
    {
        require(!withdrawRecipientLocked, "LOCKED");
        withdrawRecipient = _withdrawRecipient;
    }

    function lockWithdrawRecipient() external onlyOwner {
        require(!withdrawRecipientLocked, "LOCKED");
        withdrawRecipientLocked = true;
    }

    function setWithdrawMode(WithdrawMode _withdrawMode) external onlyOwner {
        require(!withdrawModeLocked, "LOCKED");
        withdrawMode = _withdrawMode;
    }

    function lockWithdrawMode() external onlyOwner {
        require(!withdrawModeLocked, "OCKED");
        withdrawModeLocked = true;
    }

    /* PUBLIC */

    function withdraw(
        address[] calldata claimTokens,
        uint256[] calldata amounts
    ) external {
        /**
         * We are using msg.sender for smaller attack surface when evaluating
         * the sender of the function call. If in future we want to handle "withdraw"
         * functionality via meta transactions, we should consider using `_msgSender`
         */
        _assertWithdrawAccess(msg.sender);

        require(withdrawRecipient != address(0), "WITHDRAW/NO_RECIPIENT");
        require(!withdrawPowerRevoked, "WITHDRAW/EMERGENCY_POWER_REVOKED");

        for (uint256 i = 0; i < claimTokens.length; i++) {
            if (claimTokens[i] == address(0)) {
                payable(withdrawRecipient).sendValue(amounts[i]);
            } else {
                IERC20(claimTokens[i]).transfer(withdrawRecipient, amounts[i]);
            }
        }

        emit Withdrawn(claimTokens, amounts);
    }

    function revokeWithdrawPower() external onlyOwner {
        withdrawPowerRevoked = true;
        emit WithdrawPowerRevoked();
    }

    /* INTERNAL */

    function _assertWithdrawAccess(address account) internal view {
        if (withdrawMode == WithdrawMode.NOBODY) {
            revert("WITHDRAW/LOCKED");
        } else if (withdrawMode == WithdrawMode.ANYONE) {
            return;
        } else if (withdrawMode == WithdrawMode.RECIPIENT) {
            require(withdrawRecipient == account, "WITHDRAW/ONLY_RECIPIENT");
        } else if (withdrawMode == WithdrawMode.OWNER) {
            require(owner() == account, "WITHDRAW/ONLY_OWNER");
        }
    }
}

File 38 of 41 : ERC2771ContextOwnable.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

/**
 * @dev Context variant with ERC2771 support.
 */
abstract contract ERC2771ContextOwnable is Initializable, Context, Ownable {
    address public _trustedForwarder;

    function __ERC2771ContextOwnable_init(address trustedForwarder)
        internal
        onlyInitializing
    {
        __ERC2771ContextOwnable_init_unchained(trustedForwarder);
    }

    function __ERC2771ContextOwnable_init_unchained(address trustedForwarder)
        internal
        onlyInitializing
    {
        _trustedForwarder = trustedForwarder;
    }

    function setTrustedForwarder(address trustedForwarder) public onlyOwner {
        _trustedForwarder = trustedForwarder;
    }

    function isTrustedForwarder(address forwarder)
        public
        view
        virtual
        returns (bool)
    {
        return forwarder == _trustedForwarder;
    }

    function _msgSender()
        internal
        view
        virtual
        override
        returns (address sender)
    {
        if (isTrustedForwarder(msg.sender)) {
            // The assembly code is more direct than the Solidity version using `abi.decode`.
            assembly {
                sender := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        } else {
            return super._msgSender();
        }
    }

    function _msgData()
        internal
        view
        virtual
        override
        returns (bytes calldata)
    {
        if (isTrustedForwarder(msg.sender)) {
            return msg.data[:msg.data.length - 20];
        } else {
            return super._msgData();
        }
    }
}

File 39 of 41 : IRoyalties.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;
pragma abicoder v2;

import "./LibPart.sol";

interface IRoyalties {
    function getRaribleV2Royalties(uint256 id)
        external
        view
        returns (LibPart.Part[] memory);
}

File 40 of 41 : LibPart.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

library LibPart {
    bytes32 public constant TYPE_HASH =
        keccak256("Part(address account,uint96 value)");

    struct Part {
        address payable account;
        uint96 value;
    }

    function hash(Part memory part) internal pure returns (bytes32) {
        return keccak256(abi.encode(TYPE_HASH, part.account, part.value));
    }
}

File 41 of 41 : LibRoyaltiesV2.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.9;

library LibRoyaltiesV2 {
    /*
     * bytes4(keccak256('getRaribleV2Royalties(uint256)')) == 0xcad96cca
     */
    bytes4 constant _INTERFACE_ID_ROYALTIES = 0xcad96cca;
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 6
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"contractURI","type":"string"},{"internalType":"string","name":"placeholderURI","type":"string"},{"internalType":"string","name":"tokenURIPrefix","type":"string"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"preSalePrice","type":"uint256"},{"internalType":"uint256","name":"preSaleMaxMintPerWallet","type":"uint256"},{"internalType":"uint256","name":"publicSalePrice","type":"uint256"},{"internalType":"uint256","name":"publicSaleMaxMintPerTx","type":"uint256"},{"internalType":"address","name":"defaultRoyaltyAddress","type":"address"},{"internalType":"uint16","name":"defaultRoyaltyBps","type":"uint16"},{"internalType":"address","name":"proceedsRecipient","type":"address"},{"internalType":"address","name":"trustedForwarder","type":"address"}],"internalType":"struct ERC721SimpleSalesCollection.Config","name":"config","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"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":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint16","name":"bps","type":"uint16"}],"name":"DefaultRoyaltySet","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":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenRoyaltyRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint16","name":"bps","type":"uint16"}],"name":"TokenRoyaltySet","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":[],"name":"WithdrawPowerRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"claimTokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"LOCKER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultRoyalty","outputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"bps","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ticketTokenIds","type":"uint256[]"}],"name":"filterUnlocked","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freezeMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"freezeTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInfo","outputs":[{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint256","name":"_senderBalance","type":"uint256"},{"internalType":"uint256","name":"_preSalePrice","type":"uint256"},{"internalType":"uint256","name":"_preSaleMaxMintPerWallet","type":"uint256"},{"internalType":"uint256","name":"_preSaleAlreadyClaimed","type":"uint256"},{"internalType":"bool","name":"_preSaleActive","type":"bool"},{"internalType":"uint256","name":"_publicSalePrice","type":"uint256"},{"internalType":"uint256","name":"_publicSaleMaxMintPerTx","type":"uint256"},{"internalType":"bool","name":"_publicSaleActive","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getRaribleV2Royalties","outputs":[{"components":[{"internalType":"address payable","name":"account","type":"address"},{"internalType":"uint96","name":"value","type":"uint96"}],"internalType":"struct LibPart.Part[]","name":"result","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenRoyaltiesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getTokenRoyaltyByIndex","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"bps","type":"uint16"}],"internalType":"struct IEIP2981RoyaltyOverride.TokenRoyaltyConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasRoleBasedLockableExtension","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"contractURI","type":"string"},{"internalType":"string","name":"placeholderURI","type":"string"},{"internalType":"string","name":"tokenURIPrefix","type":"string"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"preSalePrice","type":"uint256"},{"internalType":"uint256","name":"preSaleMaxMintPerWallet","type":"uint256"},{"internalType":"uint256","name":"publicSalePrice","type":"uint256"},{"internalType":"uint256","name":"publicSaleMaxMintPerTx","type":"uint256"},{"internalType":"address","name":"defaultRoyaltyAddress","type":"address"},{"internalType":"uint16","name":"defaultRoyaltyBps","type":"uint16"},{"internalType":"address","name":"proceedsRecipient","type":"address"},{"internalType":"address","name":"trustedForwarder","type":"address"}],"internalType":"struct ERC721SimpleSalesCollection.Config","name":"config","type":"tuple"},{"internalType":"address","name":"deployer","type":"address"}],"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":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockWithdrawMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lockWithdrawRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupplyFrozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"mintByOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"mintByRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"count","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"mintPreSale","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"mintPublicSale","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"onPreSaleAllowList","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":[],"name":"placeholderURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preSaleAllowlistMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preSaleMaxMintPerWallet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preSalePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preSaleStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleMaxMintPerTx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSalePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"revokeWithdrawPower","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"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":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newRoot","type":"bytes32"}],"name":"setAllowlistMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newValue","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"bps","type":"uint16"}],"internalType":"struct IEIP2981RoyaltyOverride.TokenRoyalty","name":"royalty","type":"tuple"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newValue","type":"string"}],"name":"setPlaceholderURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setPreSaleMaxMintPerWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setPreSalePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setPublicSaleMaxMintPerTx","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setPublicSalePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"bps","type":"uint16"}],"internalType":"struct IEIP2981RoyaltyOverride.TokenRoyaltyConfig[]","name":"royaltyConfigs","type":"tuple[]"}],"name":"setTokenRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newValue","type":"string"}],"name":"setTokenURIPrefix","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newValue","type":"string"}],"name":"setTokenURISuffix","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"trustedForwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum WithdrawMode","name":"_withdrawMode","type":"uint8"}],"name":"setWithdrawMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_withdrawRecipient","type":"address"}],"name":"setWithdrawRecipient","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":"bool","name":"isActive","type":"bool"}],"name":"togglePreSaleStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"isActive","type":"bool"}],"name":"togglePublicSaleStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURIFrozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURIPrefix","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURISuffix","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"transferFromBulk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"from","type":"address[]"},{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"transferFromBulk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"claimTokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawMode","outputs":[{"internalType":"enum WithdrawMode","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawModeLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawPowerRevoked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawRecipientLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

608060405260006012553480156200001657600080fd5b5060405162006e6d38038062006e6d833981016040819052620000399162000e7e565b80516020820151620000546200004e6200009a565b620000b6565b81516200006990600390602085019062000ca3565b5080516200007f90600490602084019062000ca3565b505060016013555062000093813362000111565b5062001109565b6000620000b16200027e60201b62002e361760201c565b905090565b600080546001600160a01b038381166201000081810262010000600160b01b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b60006200011f6001620002b7565b9050801562000138576000805461ff0019166101001790555b6200014560008362000369565b6200015082620000b6565b6101808301516200016390600262000379565b8251602084015160408501516200017c929190620003af565b6200019683606001518460800151620003e660201b60201c565b60a0830151620001a6906200041c565b620001b062000454565b620001bb826200048a565b620001c5620004bf565b620001df8360c001518460e00151620004f360201b60201c565b620001fb8361010001518461012001516200053a60201b60201c565b620002178361014001518461016001516200057060201b60201c565b6101a08301516200022890620005a6565b62000232620005db565b801562000279576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b6022546000906001600160a01b0316331415620002a2575060131936013560601c90565b620000b16200060f60201b62002e581760201c565b60008054610100900460ff161562000320578160ff166001148015620002f05750620002ee306200061360201b62002e5c1760201c565b155b620003185760405162461bcd60e51b81526004016200030f906200101d565b60405180910390fd5b506000919050565b60005460ff8084169116106200034a5760405162461bcd60e51b81526004016200030f906200101d565b506000805460ff191660ff92909216919091179055600190565b919050565b62000375828262000622565b5050565b600054610100900460ff16620003a35760405162461bcd60e51b81526004016200030f906200106b565b620003758282620006c8565b600054610100900460ff16620003d95760405162461bcd60e51b81526004016200030f906200106b565b6200027983838362000754565b600054610100900460ff16620004105760405162461bcd60e51b81526004016200030f906200106b565b620003758282620007f6565b600054610100900460ff16620004465760405162461bcd60e51b81526004016200030f906200106b565b62000451816200089f565b50565b600054610100900460ff166200047e5760405162461bcd60e51b81526004016200030f906200106b565b62000488620008f2565b565b600054610100900460ff16620004b45760405162461bcd60e51b81526004016200030f906200106b565b62000451816200092e565b600054610100900460ff16620004e95760405162461bcd60e51b81526004016200030f906200106b565b6200048862000996565b600054610100900460ff166200051d5760405162461bcd60e51b81526004016200030f906200106b565b6200052f63209680f760e11b620009cd565b601491909155601555565b600054610100900460ff16620005645760405162461bcd60e51b81526004016200030f906200106b565b62000375828262000a51565b600054610100900460ff166200059a5760405162461bcd60e51b81526004016200030f906200106b565b62000375828262000a98565b600054610100900460ff16620005d05760405162461bcd60e51b81526004016200030f906200106b565b620004518162000b35565b600054610100900460ff16620006055760405162461bcd60e51b81526004016200030f906200106b565b6200048862000b81565b3390565b6001600160a01b03163b151590565b6000828152601d602090815260408083206001600160a01b038516845290915290205460ff1662000375576000828152601d602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620006846200009a565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600054610100900460ff16620006f25760405162461bcd60e51b81526004016200030f906200106b565b6200070463ac2ba33360e01b620009cd565b600280546001600160a01b0384166001600160a01b0319821681178355839291600162ff000160a01b03191617600160b01b8360038111156200074b576200074b620010b6565b02179055505050565b600054610100900460ff166200077e5760405162461bcd60e51b81526004016200030f906200106b565b82516200079390600d90602086019062000ca3565b508151620007a990600e90602085019062000ca3565b508051620007bf90600f90602084019062000ca3565b50620007d2633d96f4ff60e11b620009cd565b620007e46380ac58cd60e01b620009cd565b62000279635b5e139f60e01b620009cd565b600054610100900460ff16620008205760405162461bcd60e51b81526004016200030f906200106b565b81516200083590600990602085019062000ca3565b5080516200084b90600a90602084019062000ca3565b5060408051808201909152600580825264173539b7b760d91b60209092019182526200087a91600b9162000ca3565b506200088d631f2f406b60e01b620009cd565b62000375635b5e139f60e01b620009cd565b600054610100900460ff16620008c95760405162461bcd60e51b81526004016200030f906200106b565b6010819055620008e06330f487b560e11b620009cd565b620004516380ac58cd60e01b620009cd565b600054610100900460ff166200091c5760405162461bcd60e51b81526004016200030f906200106b565b62000488631aa1577160e11b620009cd565b600054610100900460ff16620009585760405162461bcd60e51b81526004016200030f906200106b565b6200096a631a056e7160e01b620009cd565b620004517f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a68262000369565b600054610100900460ff16620009c05760405162461bcd60e51b81526004016200030f906200106b565b6200048863714ad8e760e01b5b6001600160e01b0319808216141562000a295760405162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e746572666163652069640000000060448201526064016200030f565b6001600160e01b0319166000908152600160208190526040909120805460ff19169091179055565b600054610100900460ff1662000a7b5760405162461bcd60e51b81526004016200030f906200106b565b62000a8d6317e0bac360e31b620009cd565b601991909155601a55565b600054610100900460ff1662000ac25760405162461bcd60e51b81526004016200030f906200106b565b62000ad4633a47bf5160e11b620009cd565b62000ae663152a902d60e11b620009cd565b62000af863c69dbd8f60e01b620009cd565b62000b0a63656cb66560e11b620009cd565b604080518082019091526001600160a01b038316815261ffff82166020820152620002798162000bbd565b600054610100900460ff1662000b5f5760405162461bcd60e51b81526004016200030f906200106b565b602280546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff1662000bab5760405162461bcd60e51b81526004016200030f906200106b565b62000488632a7c3e4960e01b620009cd565b612710816020015161ffff161062000c065760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642062707360a81b60448201526064016200030f565b60408051808201825282516001600160a01b03168082526020808501805161ffff1691909301819052601e8054600160a01b9092026001600160b01b03199092169092171790558251905191517f2c5ea6e4103e78cb101e796fb2dace540362fc542cbff5145eaa24af7dd8fe419262000c9892916001600160a01b0392909216825261ffff16602082015260400190565b60405180910390a150565b82805462000cb190620010cc565b90600052602060002090601f01602090048101928262000cd5576000855562000d20565b82601f1062000cf057805160ff191683800117855562000d20565b8280016001018555821562000d20579182015b8281111562000d2057825182559160200191906001019062000d03565b5062000d2e92915062000d32565b5090565b5b8082111562000d2e576000815560010162000d33565b634e487b7160e01b600052604160045260246000fd5b6040516101c081016001600160401b038111828210171562000d855762000d8562000d49565b60405290565b604051601f8201601f191681016001600160401b038111828210171562000db65762000db662000d49565b604052919050565b600082601f83011262000dd057600080fd5b81516001600160401b0381111562000dec5762000dec62000d49565b602062000e02601f8301601f1916820162000d8b565b828152858284870101111562000e1757600080fd5b60005b8381101562000e3757858101830151828201840152820162000e1a565b8381111562000e495760008385840101525b5095945050505050565b80516001600160a01b03811681146200036457600080fd5b805161ffff811681146200036457600080fd5b60006020828403121562000e9157600080fd5b81516001600160401b038082111562000ea957600080fd5b908301906101c0828603121562000ebf57600080fd5b62000ec962000d5f565b82518281111562000ed957600080fd5b62000ee78782860162000dbe565b82525060208301518281111562000efd57600080fd5b62000f0b8782860162000dbe565b60208301525060408301518281111562000f2457600080fd5b62000f328782860162000dbe565b60408301525060608301518281111562000f4b57600080fd5b62000f598782860162000dbe565b60608301525060808301518281111562000f7257600080fd5b62000f808782860162000dbe565b60808301525060a0838101519082015260c0808401519082015260e0808401519082015261010080840151908201526101208084015190820152610140915062000fcc82840162000e53565b82820152610160915062000fe282840162000e6b565b82820152610180915062000ff882840162000e53565b828201526101a091506200100e82840162000e53565b91810191909152949350505050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b600181811c90821680620010e157607f821691505b602082108114156200110357634e487b7160e01b600052602260045260246000fd5b50919050565b615d5480620011196000396000f3fe6080604052600436106103f15760003560e01c806301ffc9a7146103f6578063059fb6f71461042b5780630653aca51461044d57806306fdde031461049c578063081812fc146104be578063095ea7b3146104eb578063167446071461050b57806318160ddd146105205780631a056e711461053f57806323b872dd1461055f578063248a9ca31461057f5780632a55205a1461059f5780632bb684ad146105cd5780632c233067146105fa5780632d00b5871461061a5780632d8e85b0146106485780632f2ff15d146106685780632fe388be146106885780633542aee2146106a85780633574a2dd146106c857806336568abe146106e85780633acf404d146107085780633c0e8f2c1461071e57806342842e0e1461073e578063464bd6401461075e57806349561cb9146107785780634f972f5f146107995780635136dcc7146107b957806356c022bb146107d9578063572b6c05146107f95780635a9b0b89146108195780635d36598f1461087c5780636057e0ec1461089c5780636198e339146108bd5780636352211e146108dd5780636ba572fc146108fd5780636f8b44b01461091d57806370a082311461093d578063714ad8e71461095d578063715018a6146109715780637313cba9146109865780637885fdc71461099b578063791a2519146109d65780637d7eee42146109f65780637e98034214610a16578063837fe14014610a2b578063859610c614610a405780638da5cb5b14610a6057806391d1485414610a75578063938e3d7b14610a9557806395d89b4114610ab557806399e0dd7c14610aca5780639b6860c814610aea5780639e6b2c5b14610b00578063a217fddf14610b13578063a22cb46514610b28578063a9852bfb14610b48578063aaeaca4814610b68578063af121f5414610b7e578063b27c6f2d14610b9f578063b45a3c0e14610bb5578063b6c693e514610bd5578063b88d4fde14610bef578063ba4695fd14610c0f578063c0ac998314610c24578063c0bb38ff14610c39578063c29de63014610c59578063c723955a14610c73578063c87b56dd14610c88578063cad96cca14610ca8578063d539139314610cd5578063d547741f14610cf7578063d5abeb0114610d17578063d79ff99d14610d2d578063da74222814610d40578063da82b22714610d60578063dbbc853b14610d75578063dcbe353f14610d8a578063dd46706414610daa578063de6d6d9614610dca578063e3b9a7e514610dea578063e757c17d14610e0a578063e8a3d48514610e20578063e985e9c514610e35578063ef60ceaf14610e55578063f2fde38b14610e75578063f362136714610e95578063f384702f14610eb7578063f74bbf5914610ed1578063f95df41414610ef1575b600080fd5b34801561040257600080fd5b50610416610411366004614b99565b610f11565b60405190151581526020015b60405180910390f35b34801561043757600080fd5b5061044b610446366004614cca565b610f22565b005b34801561045957600080fd5b5061046d610468366004614d27565b610fc2565b60408051825181526020808401516001600160a01b0316908201529181015161ffff1690820152606001610422565b3480156104a857600080fd5b506104b1611049565b6040516104229190614d98565b3480156104ca57600080fd5b506104de6104d9366004614d27565b611058565b6040516104229190614dab565b3480156104f757600080fd5b5061044b610506366004614dbf565b6110e5565b34801561051757600080fd5b5061044b611208565b34801561052c57600080fd5b506012545b604051908152602001610422565b34801561054b57600080fd5b5061044b61055a366004614dbf565b611256565b34801561056b57600080fd5b5061044b61057a366004614de9565b6112bc565b34801561058b57600080fd5b5061053161059a366004614d27565b6112f4565b3480156105ab57600080fd5b506105bf6105ba366004614e25565b611309565b604051610422929190614e47565b3480156105d957600080fd5b506105ed6105e8366004614ea4565b6113ce565b6040516104229190614ee5565b34801561060657600080fd5b5061044b610615366004614f29565b611498565b34801561062657600080fd5b5060025461063b90600160b01b900460ff1681565b6040516104229190614f60565b34801561065457600080fd5b5061044b610663366004614f96565b61152e565b34801561067457600080fd5b5061044b610683366004614fb3565b611580565b34801561069457600080fd5b5061044b6106a3366004615041565b61159c565b3480156106b457600080fd5b5061044b6106c3366004614dbf565b611701565b3480156106d457600080fd5b5061044b6106e3366004615135565b611740565b3480156106f457600080fd5b5061044b610703366004614fb3565b611792565b34801561071457600080fd5b5061053160165481565b34801561072a57600080fd5b5061044b610739366004614d27565b61181c565b34801561074a57600080fd5b5061044b610759366004614de9565b611860565b34801561076a57600080fd5b506017546104169060ff1681565b34801561078457600080fd5b5060025461041690600160b81b900460ff1681565b3480156107a557600080fd5b5061044b6107b4366004614f96565b61187b565b3480156107c557600080fd5b5061044b6107d4366004615169565b6118cd565b3480156107e557600080fd5b506022546104de906001600160a01b031681565b34801561080557600080fd5b506104166108143660046151dd565b611967565b34801561082557600080fd5b5061082e61197b565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925260a0860152151560c085015260e0840152610100830152151561012082015261014001610422565b34801561088857600080fd5b5061044b610897366004614ea4565b611b0a565b3480156108a857600080fd5b5060025461041690600160a01b900460ff1681565b3480156108c957600080fd5b5061044b6108d8366004614d27565b611bae565b3480156108e957600080fd5b506104de6108f8366004614d27565b611c1b565b34801561090957600080fd5b5061044b61091836600461520a565b611c92565b34801561092957600080fd5b5061044b610938366004614d27565b611dc3565b34801561094957600080fd5b506105316109583660046151dd565b611e70565b34801561096957600080fd5b506001610416565b34801561097d57600080fd5b5061044b611ef7565b34801561099257600080fd5b506104b1611f42565b3480156109a757600080fd5b50601e546109c8906001600160a01b03811690600160a01b900461ffff1682565b604051610422929190615395565b3480156109e257600080fd5b5061044b6109f1366004614d27565b611fd4565b348015610a0257600080fd5b5061044b610a11366004614d27565b612018565b348015610a2257600080fd5b5061053161205c565b348015610a3757600080fd5b5061044b612068565b348015610a4c57600080fd5b5061044b610a5b366004614ea4565b6120e6565b348015610a6c57600080fd5b506104de612180565b348015610a8157600080fd5b50610416610a90366004614fb3565b612195565b348015610aa157600080fd5b5061044b610ab0366004615135565b6121c0565b348015610ac157600080fd5b506104b1612212565b348015610ad657600080fd5b5061044b610ae5366004615135565b61221c565b348015610af657600080fd5b5061053160195481565b61044b610b0e3660046153b2565b612291565b348015610b1f57600080fd5b50610531600081565b348015610b3457600080fd5b5061044b610b433660046153fd565b61245d565b348015610b5457600080fd5b5061044b610b63366004615135565b61246f565b348015610b7457600080fd5b5061053160155481565b348015610b8a57600080fd5b5060025461041690600160a81b900460ff1681565b348015610bab57600080fd5b50610531601a5481565b348015610bc157600080fd5b50610416610bd0366004614d27565b6124e4565b348015610be157600080fd5b50601b546104169060ff1681565b348015610bfb57600080fd5b5061044b610c0a366004615434565b6124f1565b348015610c1b57600080fd5b5061044b61252a565b348015610c3057600080fd5b506104b1612578565b348015610c4557600080fd5b5061044b610c543660046151dd565b612587565b348015610c6557600080fd5b50600c546104169060ff1681565b348015610c7f57600080fd5b5061044b612612565b348015610c9457600080fd5b506104b1610ca3366004614d27565b6126a8565b348015610cb457600080fd5b50610cc8610cc3366004614d27565b6126b3565b60405161042291906154af565b348015610ce157600080fd5b50610531600080516020615cbf83398151915281565b348015610d0357600080fd5b5061044b610d12366004614fb3565b61276e565b348015610d2357600080fd5b5061053160105481565b61044b610d3b366004614dbf565b61278a565b348015610d4c57600080fd5b5061044b610d5b3660046151dd565b612883565b348015610d6c57600080fd5b5061044b6128e4565b348015610d8157600080fd5b506104b1612961565b348015610d9657600080fd5b506002546104de906001600160a01b031681565b348015610db657600080fd5b5061044b610dc5366004614d27565b612970565b348015610dd657600080fd5b5061044b610de5366004615510565b6129d5565b348015610df657600080fd5b50610416610e0536600461557b565b612c1d565b348015610e1657600080fd5b5061053160145481565b348015610e2c57600080fd5b506104b1612c6b565b348015610e4157600080fd5b50610416610e503660046155b4565b612c7a565b348015610e6157600080fd5b5061044b610e703660046155de565b612ca8565b348015610e8157600080fd5b5061044b610e903660046151dd565b612d01565b348015610ea157600080fd5b50610531600080516020615cff83398151915281565b348015610ec357600080fd5b506011546104169060ff1681565b348015610edd57600080fd5b5061044b610eec366004614d27565b612dae565b348015610efd57600080fd5b5061044b610f0c366004614d27565b612df2565b6000610f1c82612e6b565b92915050565b60005b8151811015610fbc57306001600160a01b03166323b872dd8585858581518110610f5157610f516155f6565b60200260200101516040518463ffffffff1660e01b8152600401610f779392919061560c565b600060405180830381600087803b158015610f9157600080fd5b505af1158015610fa5573d6000803e3d6000fd5b505050508080610fb490615646565b915050610f25565b50505050565b60408051606081018252600080825260208201819052918101919091526000610fec602084612ea7565b6000818152601f60209081526040918290208251808401845290546001600160a01b03808216835261ffff600160a01b90920482168385019081528551606081018752968752925116928501929092525116908201529392505050565b6060611053612eba565b905090565b600061106382612ec9565b6110c95760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600760205260409020546001600160a01b031690565b60006110f082611c1b565b9050806001600160a01b0316836001600160a01b0316141561115e5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016110c0565b806001600160a01b0316611170612ee6565b6001600160a01b0316148061118c575061118c81610e50612ee6565b6111f95760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b60648201526084016110c0565b6112038383612ef0565b505050565b611210612ee6565b6001600160a01b0316611221612180565b6001600160a01b0316146112475760405162461bcd60e51b81526004016110c090615661565b6011805460ff19166001179055565b611270600080516020615cbf833981519152610a90612ee6565b6112ae5760405162461bcd60e51b815260206004820152600f60248201526e4e4f545f4d494e5445525f524f4c4560881b60448201526064016110c0565b6112b88282612f5e565b5050565b6112cd6112c7612ee6565b82612fe7565b6112e95760405162461bcd60e51b81526004016110c090615696565b6112038383836130b0565b6000908152601d602052604090206001015490565b6000828152601f602052604081205481906001600160a01b03161561136e576000848152601f60205260409020546001600160a01b038116906127109061135b90600160a01b900461ffff16866156e7565b611365919061571c565b915091506113c7565b601e546001600160a01b0316158015906113945750601e54600160a01b900461ffff1615155b156113c057601e546001600160a01b038116906127109061135b90600160a01b900461ffff16866156e7565b5060009050805b9250929050565b60606000826001600160401b038111156113ea576113ea614bcd565b604051908082528060200260200182016040528015611413578160200160208202803683370190505b50905060005b8381101561149057611442858583818110611436576114366155f6565b905060200201356124e4565b61147e57848482818110611458576114586155f6565b90506020020135828281518110611471576114716155f6565b6020026020010181815250505b8061148881615646565b915050611419565b509392505050565b6114a0612ee6565b6001600160a01b03166114b1612180565b6001600160a01b0316146114d75760405162461bcd60e51b81526004016110c090615661565b600254600160b81b900460ff16156115015760405162461bcd60e51b81526004016110c090615730565b6002805482919060ff60b01b1916600160b01b83600381111561152657611526614f4a565b021790555050565b611536612ee6565b6001600160a01b0316611547612180565b6001600160a01b03161461156d5760405162461bcd60e51b81526004016110c090615661565b601b805460ff1916911515919091179055565b611589826112f4565b61159281613245565b6112038383613256565b81518351146115e75760405162461bcd60e51b815260206004820152601760248201527608ca49e9abea89ebe988a9c8ea890be9a92a69a82a8869604b1b60448201526064016110c0565b80518351146116355760405162461bcd60e51b815260206004820152601a60248201527908ca49e9abea89e968a9cbe988a9c8ea890be9a92a69a82a886960331b60448201526064016110c0565b60005b8151811015610fbc57306001600160a01b03166323b872dd858381518110611662576116626155f6565b602002602001015185848151811061167c5761167c6155f6565b6020026020010151858581518110611696576116966155f6565b60200260200101516040518463ffffffff1660e01b81526004016116bc9392919061560c565b600060405180830381600087803b1580156116d657600080fd5b505af11580156116ea573d6000803e3d6000fd5b5050505080806116f990615646565b915050611638565b611709612ee6565b6001600160a01b031661171a612180565b6001600160a01b0316146112ae5760405162461bcd60e51b81526004016110c090615661565b611748612ee6565b6001600160a01b0316611759612180565b6001600160a01b03161461177f5760405162461bcd60e51b81526004016110c090615661565b80516112b8906009906020840190614aea565b61179a612ee6565b6001600160a01b0316816001600160a01b0316146118125760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016110c0565b6112b882826132dd565b611824612ee6565b6001600160a01b0316611835612180565b6001600160a01b03161461185b5760405162461bcd60e51b81526004016110c090615661565b601a55565b611203838383604051806020016040528060008152506124f1565b611883612ee6565b6001600160a01b0316611894612180565b6001600160a01b0316146118ba5760405162461bcd60e51b81526004016110c090615661565b6017805460ff1916911515919091179055565b6118d5612ee6565b6001600160a01b03166118e6612180565b6001600160a01b03161461190c5760405162461bcd60e51b81526004016110c090615661565b6112b88282808060200260200160405190810160405280939291908181526020016000905b8282101561195d5761194e60608302860136819003810190615750565b81526020019060010190611931565b5050505050613362565b6022546001600160a01b0391821691161490565b60008080808080808080808080611990612ee6565b6001600160a01b031614611a1b57306370a082316119ac612ee6565b6040518263ffffffff1660e01b81526004016119c89190614dab565b60206040518083038186803b1580156119e057600080fd5b505afa1580156119f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a1891906157b4565b90505b601054306001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015611a5757600080fd5b505afa158015611a6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a8f91906157b4565b8260145460155460186000611aa2612ee6565b6001600160a01b03166001600160a01b0316815260200190815260200160002054601760009054906101000a900460ff16601954601a54601b60009054906101000a900460ff169a509a509a509a509a509a509a509a509a509a505090919293949596979899565b60026013541415611b2d5760405162461bcd60e51b81526004016110c0906157cd565b6002601355611b4a600080516020615cff83398151915233612195565b611b665760405162461bcd60e51b81526004016110c090615804565b60005b81811015611ba457611b92838383818110611b8657611b866155f6565b90506020020135613507565b80611b9c81615646565b915050611b69565b5050600160135550565b60026013541415611bd15760405162461bcd60e51b81526004016110c0906157cd565b6002601355611bee600080516020615cff83398151915233612195565b611c0a5760405162461bcd60e51b81526004016110c090615804565b611c1381613507565b506001601355565b6000818152600560205260408120546001600160a01b031680610f1c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b60648201526084016110c0565b6000611c9e600161356e565b90508015611cb6576000805461ff0019166101001790555b611cc1600083613602565b611cca8261360c565b611cda8361018001516002613667565b611cf1836000015184602001518560400151613698565b611d03836060015184608001516136ca565b611d108360a001516136fb565b611d1861372b565b611d218261375a565b611d2961378a565b611d3b8360c001518460e001516137b9565b611d4f8361010001518461012001516137fb565b611d6383610140015184610160015161382c565b611d71836101a0015161385d565b611d7961388d565b8015611203576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b611dcb612ee6565b6001600160a01b0316611ddc612180565b6001600160a01b031614611e025760405162461bcd60e51b81526004016110c090615661565b60115460ff1615611e255760405162461bcd60e51b81526004016110c09061582d565b601254811015611e6b5760405162461bcd60e51b81526020600482015260116024820152704c4f5745525f5448414e5f535550504c5960781b60448201526064016110c0565b601055565b60006001600160a01b038216611edb5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b60648201526084016110c0565b506001600160a01b031660009081526006602052604090205490565b611eff612ee6565b6001600160a01b0316611f10612180565b6001600160a01b031614611f365760405162461bcd60e51b81526004016110c090615661565b611f40600061360c565b565b606060098054611f519061584d565b80601f0160208091040260200160405190810160405280929190818152602001828054611f7d9061584d565b8015611fca5780601f10611f9f57610100808354040283529160200191611fca565b820191906000526020600020905b815481529060010190602001808311611fad57829003601f168201915b5050505050905090565b611fdc612ee6565b6001600160a01b0316611fed612180565b6001600160a01b0316146120135760405162461bcd60e51b81526004016110c090615661565b601955565b612020612ee6565b6001600160a01b0316612031612180565b6001600160a01b0316146120575760405162461bcd60e51b81526004016110c090615661565b601455565b600061105360206138bc565b612070612ee6565b6001600160a01b0316612081612180565b6001600160a01b0316146120a75760405162461bcd60e51b81526004016110c090615661565b600254600160a01b900460ff16156120d15760405162461bcd60e51b81526004016110c090615730565b6002805460ff60a01b1916600160a01b179055565b600260135414156121095760405162461bcd60e51b81526004016110c0906157cd565b6002601355612126600080516020615cff83398151915233612195565b6121425760405162461bcd60e51b81526004016110c090615804565b60005b81811015611ba45761216e838383818110612162576121626155f6565b905060200201356138c6565b8061217881615646565b915050612145565b6000546201000090046001600160a01b031690565b6000918252601d602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6121c8612ee6565b6001600160a01b03166121d9612180565b6001600160a01b0316146121ff5760405162461bcd60e51b81526004016110c090615661565b80516112b890600f906020840190614aea565b6060611053613910565b612224612ee6565b6001600160a01b0316612235612180565b6001600160a01b03161461225b5760405162461bcd60e51b81526004016110c090615661565b600c5460ff161561227e5760405162461bcd60e51b81526004016110c09061582d565b80516112b890600a906020840190614aea565b600260135414156122b45760405162461bcd60e51b81526004016110c0906157cd565b600260135560175460ff166122f85760405162461bcd60e51b815260206004820152600a6024820152694e4f545f41435449564560b01b60448201526064016110c0565b6000612302612ee6565b905061234d83838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050601654915061234890508461391f565b613959565b6123875760405162461bcd60e51b815260206004820152600b60248201526a2ba927a723afa82927a7a360a91b60448201526064016110c0565b6015546001600160a01b0382166000908152601860205260409020546123ae908690615882565b11156123ed5760405162461bcd60e51b815260206004820152600e60248201526d14149157d4d0531157d31253525560921b60448201526064016110c0565b34846014546123fc91906156e7565b111561241a5760405162461bcd60e51b81526004016110c09061589a565b6001600160a01b03811660009081526018602052604081208054869290612442908490615882565b9091555061245290508185612f5e565b505060016013555050565b6112b8612468612ee6565b838361396f565b612477612ee6565b6001600160a01b0316612488612180565b6001600160a01b0316146124ae5760405162461bcd60e51b81526004016110c090615661565b600c5460ff16156124d15760405162461bcd60e51b81526004016110c09061582d565b80516112b890600b906020840190614aea565b6000610f1c601c83613a3a565b6125026124fc612ee6565b83612fe7565b61251e5760405162461bcd60e51b81526004016110c090615696565b610fbc84848484613a5e565b612532612ee6565b6001600160a01b0316612543612180565b6001600160a01b0316146125695760405162461bcd60e51b81526004016110c090615661565b600c805460ff19166001179055565b6060600a8054611f519061584d565b61258f612ee6565b6001600160a01b03166125a0612180565b6001600160a01b0316146125c65760405162461bcd60e51b81526004016110c090615661565b600254600160a01b900460ff16156125f05760405162461bcd60e51b81526004016110c090615730565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b61261a612ee6565b6001600160a01b031661262b612180565b6001600160a01b0316146126515760405162461bcd60e51b81526004016110c090615661565b600254600160b81b900460ff16156126935760405162461bcd60e51b815260206004820152600560248201526413d0d2d15160da1b60448201526064016110c0565b6002805460ff60b81b1916600160b81b179055565b6060610f1c82613a91565b604080516001808252818301909252606091816020015b60408051808201909152600080825260208201528152602001906001900390816126ca575050601e5481519192506001600160a01b0316908290600090612713576127136155f6565b60209081029190910101516001600160a01b03919091169052601e548151600160a01b90910461ffff1690829060009061274f5761274f6155f6565b6020908102919091018101516001600160601b03909216910152919050565b612777826112f4565b61278081613245565b61120383836132dd565b600260135414156127ad5760405162461bcd60e51b81526004016110c0906157cd565b6002601355601b5460ff166127fd5760405162461bcd60e51b81526020600482015260166024820152755055424c49435f53414c455f4e4f545f41435449564560501b60448201526064016110c0565b601a548111156128435760405162461bcd60e51b8152602060048201526011602482015270141550931250d7d4d0531157d312535255607a1b60448201526064016110c0565b348160195461285291906156e7565b11156128705760405162461bcd60e51b81526004016110c09061589a565b61287a8282612f5e565b50506001601355565b61288b612ee6565b6001600160a01b031661289c612180565b6001600160a01b0316146128c25760405162461bcd60e51b81526004016110c090615661565b602280546001600160a01b0319166001600160a01b0392909216919091179055565b6128ec612ee6565b6001600160a01b03166128fd612180565b6001600160a01b0316146129235760405162461bcd60e51b81526004016110c090615661565b6002805460ff60a81b1916600160a81b1790556040517fa24423a69b45c25c0479663125e48b482e71d85eae416f589545243bafaf3c9590600090a1565b6060600b8054611f519061584d565b600260135414156129935760405162461bcd60e51b81526004016110c0906157cd565b60026013556129b0600080516020615cff83398151915233612195565b6129cc5760405162461bcd60e51b81526004016110c090615804565b611c13816138c6565b6129de33613b6d565b6002546001600160a01b0316612a2e5760405162461bcd60e51b815260206004820152601560248201527415d2551211149055cbd393d7d49150d25412515395605a1b60448201526064016110c0565b600254600160a81b900460ff1615612a885760405162461bcd60e51b815260206004820181905260248201527f57495448445241572f454d455247454e43595f504f5745525f5245564f4b454460448201526064016110c0565b60005b83811015612bd9576000858583818110612aa757612aa76155f6565b9050602002016020810190612abc91906151dd565b6001600160a01b03161415612b0057612afb838383818110612ae057612ae06155f6565b6002546001600160a01b031692602090910201359050613cf6565b612bc7565b848482818110612b1257612b126155f6565b9050602002016020810190612b2791906151dd565b6002546001600160a01b039182169163a9059cbb9116858585818110612b4f57612b4f6155f6565b905060200201356040518363ffffffff1660e01b8152600401612b73929190614e47565b602060405180830381600087803b158015612b8d57600080fd5b505af1158015612ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bc591906158c7565b505b80612bd181615646565b915050612a8b565b507fd40c399a83caf67d15628b821aa7c7bd940e563c57a047e2bd3b8c602bcaf5a584848484604051612c0f94939291906158e4565b60405180910390a150505050565b6000612c6383838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050601654915061234890508761391f565b949350505050565b6060600f8054611f519061584d565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b612cb0612ee6565b6001600160a01b0316612cc1612180565b6001600160a01b031614612ce75760405162461bcd60e51b81526004016110c090615661565b612cfe612cf936839003830183615966565b613e0c565b50565b612d09612ee6565b6001600160a01b0316612d1a612180565b6001600160a01b031614612d405760405162461bcd60e51b81526004016110c090615661565b6001600160a01b038116612da55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016110c0565b612cfe8161360c565b612db6612ee6565b6001600160a01b0316612dc7612180565b6001600160a01b031614612ded5760405162461bcd60e51b81526004016110c090615661565b601555565b612dfa612ee6565b6001600160a01b0316612e0b612180565b6001600160a01b031614612e315760405162461bcd60e51b81526004016110c090615661565b601655565b6000612e4133611967565b15612e53575060131936013560601c90565b503390565b3390565b6001600160a01b03163b151590565b60006301ffc9a760e01b6001600160e01b031983161480610f1c5750506001600160e01b03191660009081526001602052604090205460ff1690565b6000612eb38383613eb7565b9392505050565b6060600d8054611f519061584d565b6000908152600560205260409020546001600160a01b0316151590565b6000611053612e36565b600081815260076020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612f2582611c1b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60105481612f6b60125490565b612f759190615882565b1115612fb45760405162461bcd60e51b815260206004820152600e60248201526d455843454544535f535550504c5960901b60448201526064016110c0565b60005b8181101561120357601254612fcc8482613ee1565b612fd4613efb565b5080612fdf81615646565b915050612fb7565b6000612ff282612ec9565b6130535760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084016110c0565b600061305e83611c1b565b9050806001600160a01b0316846001600160a01b0316148061308557506130858185612c7a565b80612c635750836001600160a01b031661309e84611058565b6001600160a01b031614949350505050565b826001600160a01b03166130c382611c1b565b6001600160a01b0316146131275760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b60648201526084016110c0565b6001600160a01b0382166131895760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016110c0565b613194838383613f12565b61319f600082612ef0565b6001600160a01b03831660009081526006602052604081208054600192906131c89084906159c0565b90915550506001600160a01b03821660009081526006602052604081208054600192906131f6908490615882565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615cdf83398151915291a4505050565b612cfe81613251612ee6565b613f1d565b6132608282612195565b6112b8576000828152601d602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613299612ee6565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6132e78282612195565b156112b8576000828152601d602090815260408083206001600160a01b03851684529091529020805460ff1916905561331e612ee6565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60005b81518110156112b8576000828281518110613382576133826155f6565b60200260200101519050612710816040015161ffff16106133b55760405162461bcd60e51b81526004016110c0906159d7565b60208101516001600160a01b031661342f5780516000908152601f6020908152604090912080546001600160b01b031916905581516133f49190613f81565b5080516040519081527fa2870857763bd9ae76c957f869f16b31c18dd3bb4c7b4d3a4496dc5c57c657f99060200160405180910390a16134f4565b6040805180820182526020808401516001600160a01b0390811683528484015161ffff90811683850190815286516000908152601f855295909520935184549551909116600160a01b026001600160b01b0319909516911617929092179055815161349a9190613f8d565b50805160208083015160408085015181519485526001600160a01b039092169284019290925261ffff1682820152517f389b70fb0887f01e83784eb1c4c589f740eca53b00ed0f45e41db5d079719abb9181900360600190a15b50806134ff81615646565b915050613365565b613512601c82613a3a565b61354b5760405162461bcd60e51b815260206004820152600a6024820152691393d517d313d0d2d15160b21b60448201526064016110c0565b600881901c6000908152601c602052604090208054600160ff84161b1916905550565b60008054610100900460ff16156135bc578160ff166001148015613598575061359630612e5c565b155b6135b45760405162461bcd60e51b81526004016110c0906159fc565b506000919050565b60005460ff8084169116106135e35760405162461bcd60e51b81526004016110c0906159fc565b506000805460ff191660ff92909216919091179055600190565b919050565b6112b88282613256565b600080546001600160a01b038381166201000081810262010000600160b01b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b600054610100900460ff1661368e5760405162461bcd60e51b81526004016110c090615a4a565b6112b88282613f99565b600054610100900460ff166136bf5760405162461bcd60e51b81526004016110c090615a4a565b61120383838361401d565b600054610100900460ff166136f15760405162461bcd60e51b81526004016110c090615a4a565b6112b882826140b0565b600054610100900460ff166137225760405162461bcd60e51b81526004016110c090615a4a565b612cfe8161414c565b600054610100900460ff166137525760405162461bcd60e51b81526004016110c090615a4a565b611f40614198565b600054610100900460ff166137815760405162461bcd60e51b81526004016110c090615a4a565b612cfe816141cf565b600054610100900460ff166137b15760405162461bcd60e51b81526004016110c090615a4a565b611f4061421e565b600054610100900460ff166137e05760405162461bcd60e51b81526004016110c090615a4a565b6137f063209680f760e11b614251565b601491909155601555565b600054610100900460ff166138225760405162461bcd60e51b81526004016110c090615a4a565b6112b882826142d2565b600054610100900460ff166138535760405162461bcd60e51b81526004016110c090615a4a565b6112b88282614314565b600054610100900460ff166138845760405162461bcd60e51b81526004016110c090615a4a565b612cfe816143a4565b600054610100900460ff166138b45760405162461bcd60e51b81526004016110c090615a4a565b611f406143cb565b6000610f1c825490565b6138d1601c82613a3a565b156138ee5760405162461bcd60e51b81526004016110c090615730565b600881901c6000908152601c602052604090208054600160ff84161b17905550565b6060600e8054611f519061584d565b6040516001600160601b0319606083901b166020820152600090603401604051602081830303815290604052805190602001209050919050565b6000826139668584614402565b14949350505050565b816001600160a01b0316836001600160a01b031614156139cd5760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b60448201526064016110c0565b6001600160a01b03838116600081815260086020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b600881901c600090815260208390526040902054600160ff83161b16151592915050565b613a698484846130b0565b613a758484848461446e565b610fbc5760405162461bcd60e51b81526004016110c090615a95565b60606000600a8054613aa29061584d565b905011613b395760098054613ab69061584d565b80601f0160208091040260200160405190810160405280929190818152602001828054613ae29061584d565b8015613b2f5780601f10613b0457610100808354040283529160200191613b2f565b820191906000526020600020905b815481529060010190602001808311613b1257829003601f168201915b5050505050610f1c565b600a613b4483614589565b600b604051602001613b5893929190615b81565b60405160208183030381529060405292915050565b6003600254600160b01b900460ff166003811115613b8d57613b8d614f4a565b1415613bcd5760405162461bcd60e51b815260206004820152600f60248201526e15d2551211149055cbd313d0d2d151608a1b60448201526064016110c0565b60028054600160b01b900460ff166003811115613bec57613bec614f4a565b1415613bf55750565b6001600254600160b01b900460ff166003811115613c1557613c15614f4a565b1415613c72576002546001600160a01b03828116911614612cfe5760405162461bcd60e51b815260206004820152601760248201527615d2551211149055cbd3d3931657d49150d25412515395604a1b60448201526064016110c0565b6000600254600160b01b900460ff166003811115613c9257613c92614f4a565b1415612cfe57806001600160a01b0316613caa612180565b6001600160a01b031614612cfe5760405162461bcd60e51b81526020600482015260136024820152722ba4aa24222920ab97a7a7262cafa7aba722a960691b60448201526064016110c0565b80471015613d465760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016110c0565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613d93576040519150601f19603f3d011682016040523d82523d6000602084013e613d98565b606091505b50509050806112035760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b60648201526084016110c0565b612710816020015161ffff1610613e355760405162461bcd60e51b81526004016110c0906159d7565b60408051808201825282516001600160a01b03168082526020808501805161ffff1691909301819052601e80546001600160b01b031916909217600160a01b9091021790558251905191517f2c5ea6e4103e78cb101e796fb2dace540362fc542cbff5145eaa24af7dd8fe4192613eac9291615395565b60405180910390a150565b6000826000018281548110613ece57613ece6155f6565b9060005260206000200154905092915050565b6112b8828260405180602001604052806000815250614686565b60128054906000613f0b83615646565b9190505550565b6112038383836146b9565b613f278282612195565b6112b857613f3f816001600160a01b031660146146e1565b613f4a8360206146e1565b604051602001613f5b929190615bb4565b60408051601f198184030181529082905262461bcd60e51b82526110c091600401614d98565b6000612eb3838361487c565b6000612eb3838361496f565b600054610100900460ff16613fc05760405162461bcd60e51b81526004016110c090615a4a565b613fd063ac2ba33360e01b614251565b600280546001600160a01b0384166001600160a01b0319821681178355839291600162ff000160a01b03191617600160b01b83600381111561401457614014614f4a565b02179055505050565b600054610100900460ff166140445760405162461bcd60e51b81526004016110c090615a4a565b825161405790600d906020860190614aea565b50815161406b90600e906020850190614aea565b50805161407f90600f906020840190614aea565b50614090633d96f4ff60e11b614251565b6140a06380ac58cd60e01b614251565b611203635b5e139f60e01b614251565b600054610100900460ff166140d75760405162461bcd60e51b81526004016110c090615a4a565b81516140ea906009906020850190614aea565b5080516140fe90600a906020840190614aea565b5060408051808201909152600580825264173539b7b760d91b602090920191825261412b91600b91614aea565b5061413c631f2f406b60e01b614251565b6112b8635b5e139f60e01b614251565b600054610100900460ff166141735760405162461bcd60e51b81526004016110c090615a4a565b60108190556141886330f487b560e11b614251565b612cfe6380ac58cd60e01b614251565b600054610100900460ff166141bf5760405162461bcd60e51b81526004016110c090615a4a565b611f40631aa1577160e11b614251565b600054610100900460ff166141f65760405162461bcd60e51b81526004016110c090615a4a565b614206631a056e7160e01b614251565b612cfe600080516020615cbf83398151915282613602565b600054610100900460ff166142455760405162461bcd60e51b81526004016110c090615a4a565b611f4063714ad8e760e01b5b6001600160e01b031980821614156142aa5760405162461bcd60e51b815260206004820152601c60248201527b115490cc4d8d4e881a5b9d985b1a59081a5b9d195c999858d9481a5960221b60448201526064016110c0565b6001600160e01b0319166000908152600160208190526040909120805460ff19169091179055565b600054610100900460ff166142f95760405162461bcd60e51b81526004016110c090615a4a565b6143096317e0bac360e31b614251565b601991909155601a55565b600054610100900460ff1661433b5760405162461bcd60e51b81526004016110c090615a4a565b61434b633a47bf5160e11b614251565b61435b63152a902d60e11b614251565b61436b63c69dbd8f60e01b614251565b61437b63656cb66560e11b614251565b604080518082019091526001600160a01b038316815261ffff8216602082015261120381613e0c565b600054610100900460ff166128c25760405162461bcd60e51b81526004016110c090615a4a565b600054610100900460ff166143f25760405162461bcd60e51b81526004016110c090615a4a565b611f40632a7c3e4960e01b614251565b600081815b8451811015611490576000858281518110614424576144246155f6565b6020026020010151905080831161444a576000838152602082905260409020925061445b565b600081815260208490526040902092505b508061446681615646565b915050614407565b6000614482846001600160a01b0316612e5c565b1561457e57836001600160a01b031663150b7a0261449e612ee6565b8786866040518563ffffffff1660e01b81526004016144c09493929190615c23565b602060405180830381600087803b1580156144da57600080fd5b505af192505050801561450a575060408051601f3d908101601f1916820190925261450791810190615c60565b60015b614564573d808015614538576040519150601f19603f3d011682016040523d82523d6000602084013e61453d565b606091505b50805161455c5760405162461bcd60e51b81526004016110c090615a95565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612c63565b506001949350505050565b6060816145ad5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156145d757806145c181615646565b91506145d09050600a8361571c565b91506145b1565b6000816001600160401b038111156145f1576145f1614bcd565b6040519080825280601f01601f19166020018201604052801561461b576020820181803683370190505b5090505b8415612c63576146306001836159c0565b915061463d600a86615c7d565b614648906030615882565b60f81b81838151811061465d5761465d6155f6565b60200101906001600160f81b031916908160001a90535061467f600a8661571c565b945061461f565b61469083836149be565b61469d600084848461446e565b6112035760405162461bcd60e51b81526004016110c090615a95565b6146c4601c82613a3a565b156112035760405162461bcd60e51b81526004016110c090615730565b606060006146f08360026156e7565b6146fb906002615882565b6001600160401b0381111561471257614712614bcd565b6040519080825280601f01601f19166020018201604052801561473c576020820181803683370190505b509050600360fc1b81600081518110614757576147576155f6565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110614786576147866155f6565b60200101906001600160f81b031916908160001a90535060006147aa8460026156e7565b6147b5906001615882565b90505b600181111561482d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106147e9576147e96155f6565b1a60f81b8282815181106147ff576147ff6155f6565b60200101906001600160f81b031916908160001a90535060049490941c9361482681615c91565b90506147b8565b508315612eb35760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016110c0565b600081815260018301602052604081205480156149655760006148a06001836159c0565b85549091506000906148b4906001906159c0565b90508181146149195760008660000182815481106148d4576148d46155f6565b90600052602060002001549050808760000184815481106148f7576148f76155f6565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061492a5761492a615ca8565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610f1c565b6000915050610f1c565b60008181526001830160205260408120546149b657508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610f1c565b506000610f1c565b6001600160a01b038216614a145760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016110c0565b614a1d81612ec9565b15614a695760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b60448201526064016110c0565b614a7560008383613f12565b6001600160a01b0382166000908152600660205260408120805460019290614a9e908490615882565b909155505060008181526005602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020615cdf833981519152908290a45050565b828054614af69061584d565b90600052602060002090601f016020900481019282614b185760008555614b5e565b82601f10614b3157805160ff1916838001178555614b5e565b82800160010185558215614b5e579182015b82811115614b5e578251825591602001919060010190614b43565b50614b6a929150614b6e565b5090565b5b80821115614b6a5760008155600101614b6f565b6001600160e01b031981168114612cfe57600080fd5b600060208284031215614bab57600080fd5b8135612eb381614b83565b80356001600160a01b03811681146135fd57600080fd5b634e487b7160e01b600052604160045260246000fd5b6040516101c081016001600160401b0381118282101715614c0657614c06614bcd565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614c3457614c34614bcd565b604052919050565b60006001600160401b03821115614c5557614c55614bcd565b5060051b60200190565b600082601f830112614c7057600080fd5b81356020614c85614c8083614c3c565b614c0c565b82815260059290921b84018101918181019086841115614ca457600080fd5b8286015b84811015614cbf5780358352918301918301614ca8565b509695505050505050565b600080600060608486031215614cdf57600080fd5b614ce884614bb6565b9250614cf660208501614bb6565b915060408401356001600160401b03811115614d1157600080fd5b614d1d86828701614c5f565b9150509250925092565b600060208284031215614d3957600080fd5b5035919050565b60005b83811015614d5b578181015183820152602001614d43565b83811115610fbc5750506000910152565b60008151808452614d84816020860160208601614d40565b601f01601f19169290920160200192915050565b602081526000612eb36020830184614d6c565b6001600160a01b0391909116815260200190565b60008060408385031215614dd257600080fd5b614ddb83614bb6565b946020939093013593505050565b600080600060608486031215614dfe57600080fd5b614e0784614bb6565b9250614e1560208501614bb6565b9150604084013590509250925092565b60008060408385031215614e3857600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60008083601f840112614e7257600080fd5b5081356001600160401b03811115614e8957600080fd5b6020830191508360208260051b85010111156113c757600080fd5b60008060208385031215614eb757600080fd5b82356001600160401b03811115614ecd57600080fd5b614ed985828601614e60565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b81811015614f1d57835183529284019291840191600101614f01565b50909695505050505050565b600060208284031215614f3b57600080fd5b813560048110612eb357600080fd5b634e487b7160e01b600052602160045260246000fd5b6020810160048310614f8257634e487b7160e01b600052602160045260246000fd5b91905290565b8015158114612cfe57600080fd5b600060208284031215614fa857600080fd5b8135612eb381614f88565b60008060408385031215614fc657600080fd5b82359150614fd660208401614bb6565b90509250929050565b600082601f830112614ff057600080fd5b81356020615000614c8083614c3c565b82815260059290921b8401810191818101908684111561501f57600080fd5b8286015b84811015614cbf5761503481614bb6565b8352918301918301615023565b60008060006060848603121561505657600080fd5b83356001600160401b038082111561506d57600080fd5b61507987838801614fdf565b9450602086013591508082111561508f57600080fd5b61509b87838801614fdf565b935060408601359150808211156150b157600080fd5b50614d1d86828701614c5f565b60006001600160401b038311156150d7576150d7614bcd565b6150ea601f8401601f1916602001614c0c565b90508281528383830111156150fe57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261512657600080fd5b612eb3838335602085016150be565b60006020828403121561514757600080fd5b81356001600160401b0381111561515d57600080fd5b612c6384828501615115565b6000806020838503121561517c57600080fd5b82356001600160401b038082111561519357600080fd5b818501915085601f8301126151a757600080fd5b8135818111156151b657600080fd5b8660206060830285010111156151cb57600080fd5b60209290920196919550909350505050565b6000602082840312156151ef57600080fd5b612eb382614bb6565b803561ffff811681146135fd57600080fd5b6000806040838503121561521d57600080fd5b82356001600160401b038082111561523457600080fd5b908401906101c0828703121561524957600080fd5b615251614be3565b82358281111561526057600080fd5b61526c88828601615115565b82525060208301358281111561528157600080fd5b61528d88828601615115565b6020830152506040830135828111156152a557600080fd5b6152b188828601615115565b6040830152506060830135828111156152c957600080fd5b6152d588828601615115565b6060830152506080830135828111156152ed57600080fd5b6152f988828601615115565b60808301525060a0838101359082015260c0808401359082015260e08084013590820152610100808401359082015261012080840135908201526101409150615343828401614bb6565b8282015261016091506153578284016151f8565b82820152610180915061536b828401614bb6565b828201526101a0915061537f828401614bb6565b82820152809450505050614fd660208401614bb6565b6001600160a01b0392909216825261ffff16602082015260400190565b6000806000604084860312156153c757600080fd5b8335925060208401356001600160401b038111156153e457600080fd5b6153f086828701614e60565b9497909650939450505050565b6000806040838503121561541057600080fd5b61541983614bb6565b9150602083013561542981614f88565b809150509250929050565b6000806000806080858703121561544a57600080fd5b61545385614bb6565b935061546160208601614bb6565b92506040850135915060608501356001600160401b0381111561548357600080fd5b8501601f8101871361549457600080fd5b6154a3878235602084016150be565b91505092959194509250565b602080825282518282018190526000919060409081850190868401855b8281101561550357815180516001600160a01b031685528601516001600160601b03168685015292840192908501906001016154cc565b5091979650505050505050565b6000806000806040858703121561552657600080fd5b84356001600160401b038082111561553d57600080fd5b61554988838901614e60565b9096509450602087013591508082111561556257600080fd5b5061556f87828801614e60565b95989497509550505050565b60008060006040848603121561559057600080fd5b61559984614bb6565b925060208401356001600160401b038111156153e457600080fd5b600080604083850312156155c757600080fd5b6155d083614bb6565b9150614fd660208401614bb6565b6000604082840312156155f057600080fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b039384168152919092166020820152604081019190915260600190565b634e487b7160e01b600052601160045260246000fd5b600060001982141561565a5761565a615630565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b600081600019048311821515161561570157615701615630565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261572b5761572b615706565b500490565b6020808252600690820152651313d0d2d15160d21b604082015260600190565b60006060828403121561576257600080fd5b604051606081016001600160401b038111828210171561578457615784614bcd565b6040528235815261579760208401614bb6565b60208201526157a8604084016151f8565b60408201529392505050565b6000602082840312156157c657600080fd5b5051919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252600f908201526e4e4f545f4c4f434b45525f524f4c4560881b604082015260600190565b602080825260069082015265232927ad22a760d11b604082015260600190565b600181811c9082168061586157607f821691505b602082108114156155f057634e487b7160e01b600052602260045260246000fd5b6000821982111561589557615895615630565b500190565b602080825260139082015272125394d551919250d251539517d05353d55395606a1b604082015260600190565b6000602082840312156158d957600080fd5b8151612eb381614f88565b6040808252810184905260008560608301825b87811015615925576001600160a01b0361591084614bb6565b168252602092830192909101906001016158f7565b5083810360208501528481526001600160fb1b0385111561594557600080fd5b8460051b915081866020830137600091016020019081529695505050505050565b60006040828403121561597857600080fd5b604080519081016001600160401b038111828210171561599a5761599a614bcd565b6040526159a683614bb6565b81526159b4602084016151f8565b60208201529392505050565b6000828210156159d2576159d2615630565b500390565b6020808252600b908201526a496e76616c69642062707360a81b604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b8054600090600181811c9080831680615b0157607f831692505b6020808410821415615b2357634e487b7160e01b600052602260045260246000fd5b818015615b375760018114615b4857615b75565b60ff19861689528489019650615b75565b60008881526020902060005b86811015615b6d5781548b820152908501908301615b54565b505084890196505b50505050505092915050565b6000615b8d8286615ae7565b8451615b9d818360208901614d40565b615ba981830186615ae7565b979650505050505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615be6816017850160208801614d40565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615c17816028840160208801614d40565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090615c5690830184614d6c565b9695505050505050565b600060208284031215615c7257600080fd5b8151612eb381614b83565b600082615c8c57615c8c615706565b500690565b600081615ca057615ca0615630565b506000190190565b634e487b7160e01b600052603160045260246000fdfe9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efaf9a8bb3cbd6b84fbccefa71ff73e26e798553c6914585a84886212a46a90279a264697066735822122029b952cc84209d5a2db1bdadd4de806f4a8da46e7d1e5995022c4a7f9c54fb5f64736f6c63430008090033000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a436f6c6c656374696f6e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003434f4c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012697066733a2f2f636f6e747261637455524900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015697066733a2f2f706c616365686f6c64657255524900000000000000000000000000000000000000000000000000000000000000000000000000000000000016697066733a2f2f746f6b656e5552495072656669782f00000000000000000000

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

000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a436f6c6c656374696f6e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003434f4c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012697066733a2f2f636f6e747261637455524900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015697066733a2f2f706c616365686f6c64657255524900000000000000000000000000000000000000000000000000000000000000000000000000000000000016697066733a2f2f746f6b656e5552495072656669782f00000000000000000000

-----Decoded View---------------
Arg [0] : config (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]

-----Encoded View---------------
25 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000200
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000240
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000280
Arg [5] : 00000000000000000000000000000000000000000000000000000000000002c0
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [10] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [15] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [16] : 436f6c6c656374696f6e00000000000000000000000000000000000000000000
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [18] : 434f4c0000000000000000000000000000000000000000000000000000000000
Arg [19] : 0000000000000000000000000000000000000000000000000000000000000012
Arg [20] : 697066733a2f2f636f6e74726163745552490000000000000000000000000000
Arg [21] : 0000000000000000000000000000000000000000000000000000000000000015
Arg [22] : 697066733a2f2f706c616365686f6c6465725552490000000000000000000000
Arg [23] : 0000000000000000000000000000000000000000000000000000000000000016
Arg [24] : 697066733a2f2f746f6b656e5552495072656669782f00000000000000000000


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.