ETH Price: $3,582.44 (+16.68%)
Gas: 43 Gwei

Token

Petopia Heroes Collection (PET HERO)
 

Overview

Max Total Supply

3,333 PET HERO

Holders

1,710

Market

Volume (24H)

0.279 ETH

Min Price (24H)

$497.96 @ 0.139000 ETH

Max Price (24H)

$501.54 @ 0.140000 ETH
Filtered by Token Holder
artbricker.eth
Balance
2 PET HERO
0x7dcc54460d8ab80809c49bc775143a0a9a1485c3
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
Petopia

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 20 runs

Other Settings:
paris EvmVersion
File 1 of 41 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../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:
 *
 * ```solidity
 * 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}:
 *
 * ```solidity
 * 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. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    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 returns (bool) {
        return _roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @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 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.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual 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.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual 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 `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @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 Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

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

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @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.
     */
    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 `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

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

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

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

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

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

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

File 5 of 41 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.20;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

File 6 of 41 : ERC2771Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (metatx/ERC2771Context.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Context variant with ERC2771 support.
 *
 * WARNING: Avoid using this pattern in contracts that rely in a specific calldata length as they'll
 * be affected by any forwarder whose `msg.data` is suffixed with the `from` address according to the ERC2771
 * specification adding the address size in bytes (20) to the calldata size. An example of an unexpected
 * behavior could be an unintended fallback (or another function) invocation while trying to invoke the `receive`
 * function only accessible if `msg.data.length == 0`.
 *
 * WARNING: The usage of `delegatecall` in this contract is dangerous and may result in context corruption.
 * Any forwarded request to this contract triggering a `delegatecall` to itself will result in an invalid {_msgSender}
 * recovery.
 */
abstract contract ERC2771Context is Context {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable _trustedForwarder;

    /**
     * @dev Initializes the contract with a trusted forwarder, which will be able to
     * invoke functions on this contract on behalf of other accounts.
     *
     * NOTE: The trusted forwarder can be replaced by overriding {trustedForwarder}.
     */
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor(address trustedForwarder_) {
        _trustedForwarder = trustedForwarder_;
    }

    /**
     * @dev Returns the address of the trusted forwarder.
     */
    function trustedForwarder() public view virtual returns (address) {
        return _trustedForwarder;
    }

    /**
     * @dev Indicates whether any particular address is the trusted forwarder.
     */
    function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
        return forwarder == trustedForwarder();
    }

    /**
     * @dev Override for `msg.sender`. Defaults to the original `msg.sender` whenever
     * a call is not performed by the trusted forwarder or the calldata length is less than
     * 20 bytes (an address length).
     */
    function _msgSender() internal view virtual override returns (address) {
        uint256 calldataLength = msg.data.length;
        uint256 contextSuffixLength = _contextSuffixLength();
        if (isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) {
            return address(bytes20(msg.data[calldataLength - contextSuffixLength:]));
        } else {
            return super._msgSender();
        }
    }

    /**
     * @dev Override for `msg.data`. Defaults to the original `msg.data` whenever
     * a call is not performed by the trusted forwarder or the calldata length is less than
     * 20 bytes (an address length).
     */
    function _msgData() internal view virtual override returns (bytes calldata) {
        uint256 calldataLength = msg.data.length;
        uint256 contextSuffixLength = _contextSuffixLength();
        if (isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) {
            return msg.data[:calldataLength - contextSuffixLength];
        } else {
            return super._msgData();
        }
    }

    /**
     * @dev ERC-2771 specifies the context as being a single address (20 bytes).
     */
    function _contextSuffixLength() internal view virtual override returns (uint256) {
        return 20;
    }
}

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

        return (royalty.receiver, royaltyAmount);
    }

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

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

        _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator);
    }

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

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

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

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

File 8 of 41 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

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

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

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

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

pragma solidity ^0.8.20;

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

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

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

File 10 of 41 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS
    }

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
     * and a bytes32 providing additional information about the error.
     *
     * If no error is returned, then the address can be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError, bytes32) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS, s);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature, bytes32(0));
        }

        return (signer, RecoverError.NoError, bytes32(0));
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}

File 11 of 41 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.20;

import {MessageHashUtils} from "./MessageHashUtils.sol";
import {ShortStrings, ShortString} from "../ShortStrings.sol";
import {IERC5267} from "../../interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
 * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
 * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
 * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev See {IERC-5267}.
     */
    function eip712Domain()
        public
        view
        virtual
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _EIP712Name(),
            _EIP712Version(),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }

    /**
     * @dev The name parameter for the EIP712 domain.
     *
     * NOTE: By default this function reads _name which is an immutable value.
     * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
     */
    // solhint-disable-next-line func-name-mixedcase
    function _EIP712Name() internal view returns (string memory) {
        return _name.toStringWithFallback(_nameFallback);
    }

    /**
     * @dev The version parameter for the EIP712 domain.
     *
     * NOTE: By default this function reads _version which is an immutable value.
     * It only reads from storage if necessary (in case the value is too large to fit in a ShortString).
     */
    // solhint-disable-next-line func-name-mixedcase
    function _EIP712Version() internal view returns (string memory) {
        return _version.toStringWithFallback(_versionFallback);
    }
}

File 12 of 41 : MessageHashUtils.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
 *
 * The library provides methods for generating a hash of a message that conforms to the
 * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
 * specifications.
 */
library MessageHashUtils {
    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing a bytes32 `messageHash` with
     * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
     * keccak256, although any bytes32 value can be safely used because the final digest will
     * be re-hashed.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash
            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
        }
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing an arbitrary `message` with
     * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
        return
            keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x00` (data with intended validator).
     *
     * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
     * `validator` address. Then hashing the result.
     *
     * See {ECDSA-recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(hex"19_00", validator, data));
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
     *
     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
     * `\x19\x01` and hashing the result. It corresponds to the hash signed by the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
     *
     * See {ECDSA-recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, hex"19_01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            digest := keccak256(ptr, 0x42)
        }
    }
}

File 13 of 41 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

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

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

File 14 of 41 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

File 15 of 41 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

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

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

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

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

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

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

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

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

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

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

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

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

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 16 of 41 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

File 17 of 41 : Multicall.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Multicall.sol)

pragma solidity ^0.8.20;

import {Address} from "./Address.sol";
import {Context} from "./Context.sol";

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * Consider any assumption about calldata validation performed by the sender may be violated if it's not especially
 * careful about sending transactions invoking {multicall}. For example, a relay address that filters function
 * selectors won't filter calls nested within a {multicall} operation.
 *
 * NOTE: Since 5.0.1 and 4.9.4, this contract identifies non-canonical contexts (i.e. `msg.sender` is not {_msgSender}).
 * If a non-canonical context is identified, the following self `delegatecall` appends the last bytes of `msg.data`
 * to the subcall. This makes it safe to use with {ERC2771Context}. Contexts that don't affect the resolution of
 * {_msgSender} are not propagated to subcalls.
 */
abstract contract Multicall is Context {
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
        bytes memory context = msg.sender == _msgSender()
            ? new bytes(0)
            : msg.data[msg.data.length - _contextSuffixLength():];

        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = Address.functionDelegateCall(address(this), bytes.concat(data[i], context));
        }
        return results;
    }
}

File 18 of 41 : ShortStrings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.20;

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

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using
     * {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}

File 19 of 41 : StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

File 20 of 41 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

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

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

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

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

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

File 21 of 41 : BatchMintMetadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
 *  @title   Batch-mint Metadata
 *  @notice  The `BatchMintMetadata` is a contract extension for any base NFT contract. It lets the smart contract
 *           using this extension set metadata for `n` number of NFTs all at once. This is enabled by storing a single
 *           base URI for a batch of `n` NFTs, where the metadata for each NFT in a relevant batch is `baseURI/tokenId`.
 */

contract BatchMintMetadata {
    /// @dev Largest tokenId of each batch of tokens with the same baseURI + 1 {ex: batchId 100 at position 0 includes tokens 0-99}
    uint256[] private batchIds;

    /// @dev Mapping from id of a batch of tokens => to base URI for the respective batch of tokens.
    mapping(uint256 => string) private baseURI;

    /// @dev Mapping from id of a batch of tokens => to whether the base URI for the respective batch of tokens is frozen.
    mapping(uint256 => bool) public batchFrozen;

    /// @dev This event emits when the metadata of all tokens are frozen.
    /// While not currently supported by marketplaces, this event allows
    /// future indexing if desired.
    event MetadataFrozen();

    // @dev This event emits when the metadata of a range of tokens is updated.
    /// So that the third-party platforms such as NFT market could
    /// timely update the images and related attributes of the NFTs.
    event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);

    /**
     *  @notice         Returns the count of batches of NFTs.
     *  @dev            Each batch of tokens has an in ID and an associated `baseURI`.
     *                  See {batchIds}.
     */
    function getBaseURICount() public view returns (uint256) {
        return batchIds.length;
    }

    /**
     *  @notice         Returns the ID for the batch of tokens at the given index.
     *  @dev            See {getBaseURICount}.
     *  @param _index   Index of the desired batch in batchIds array.
     */
    function getBatchIdAtIndex(uint256 _index) public view returns (uint256) {
        if (_index >= getBaseURICount()) {
            revert("Invalid index");
        }
        return batchIds[_index];
    }

    /// @dev Returns the id for the batch of tokens the given tokenId belongs to.
    function _getBatchId(uint256 _tokenId) internal view returns (uint256 batchId, uint256 index) {
        uint256 numOfTokenBatches = getBaseURICount();
        uint256[] memory indices = batchIds;

        for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
            if (_tokenId < indices[i]) {
                index = i;
                batchId = indices[i];

                return (batchId, index);
            }
        }

        revert("Invalid tokenId");
    }

    /// @dev Returns the baseURI for a token. The intended metadata URI for the token is baseURI + tokenId.
    function _getBaseURI(uint256 _tokenId) internal view returns (string memory) {
        uint256 numOfTokenBatches = getBaseURICount();
        uint256[] memory indices = batchIds;

        for (uint256 i = 0; i < numOfTokenBatches; i += 1) {
            if (_tokenId < indices[i]) {
                return baseURI[indices[i]];
            }
        }
        revert("Invalid tokenId");
    }

    /// @dev returns the starting tokenId of a given batchId.
    function _getBatchStartId(uint256 _batchID) internal view returns (uint256) {
        uint256 numOfTokenBatches = getBaseURICount();
        uint256[] memory indices = batchIds;

        for (uint256 i = 0; i < numOfTokenBatches; i++) {
            if (_batchID == indices[i]) {
                if (i > 0) {
                    return indices[i - 1];
                }
                return 0;
            }
        }
        revert("Invalid batchId");
    }

    /// @dev Sets the base URI for the batch of tokens with the given batchId.
    function _setBaseURI(uint256 _batchId, string memory _baseURI) internal {
        require(!batchFrozen[_batchId], "Batch frozen");
        baseURI[_batchId] = _baseURI;
        emit BatchMetadataUpdate(_getBatchStartId(_batchId), _batchId);
    }

    /// @dev Freezes the base URI for the batch of tokens with the given batchId.
    function _freezeBaseURI(uint256 _batchId) internal {
        string memory baseURIForBatch = baseURI[_batchId];
        require(bytes(baseURIForBatch).length > 0, "Invalid batch");
        batchFrozen[_batchId] = true;
        emit MetadataFrozen();
    }

    /// @dev Mints a batch of tokenIds and associates a common baseURI to all those Ids.
    function _batchMintMetadata(
        uint256 _startId,
        uint256 _amountToMint,
        string memory _baseURIForTokens
    ) internal returns (uint256 nextTokenIdToMint, uint256 batchId) {
        batchId = _startId + _amountToMint;
        nextTokenIdToMint = batchId;

        batchIds.push(batchId);

        baseURI[batchId] = _baseURIForTokens;
    }
}

File 22 of 41 : DelayedReveal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./interfaces/IDelayedReveal.sol";

abstract contract DelayedReveal is IDelayedReveal {
    /// @dev Mapping from tokenId of a batch of tokens => to delayed reveal data.
    mapping(uint256 => bytes) public encryptedData;

    /// @dev Sets the delayed reveal data for a batchId.
    function _setEncryptedData(uint256 _batchId, bytes memory _encryptedData) internal {
        encryptedData[_batchId] = _encryptedData;
    }

    function getRevealURI(uint256 _batchId, bytes calldata _key) public view returns (string memory revealedURI) {
        bytes memory data = encryptedData[_batchId];
        if (data.length == 0) {
            revert("Nothing to reveal");
        }

        (bytes memory encryptedURI, bytes32 provenanceHash) = abi.decode(data, (bytes, bytes32));

        revealedURI = string(encryptDecrypt(encryptedURI, _key));

        require(keccak256(abi.encodePacked(revealedURI, _key, block.chainid)) == provenanceHash, "Incorrect key");
    }

    /**
     *  @notice         Encrypt/decrypt data on chain.
     *  @dev            Encrypt/decrypt given `data` with `key`. Uses inline assembly.
     *                  See: https://ethereum.stackexchange.com/questions/69825/decrypt-message-on-chain
     *
     *  @param data     Bytes of data to encrypt/decrypt.
     *  @param key      Secure key used by caller for encryption/decryption.
     *
     *  @return result  Output after encryption/decryption of given data.
     */
    function encryptDecrypt(bytes memory data, bytes calldata key) public pure override returns (bytes memory result) {
        // Store data length on stack for later use
        uint256 length = data.length;

        // solhint-disable-next-line no-inline-assembly
        assembly {
        // Set result to free memory pointer
            result := mload(0x40)
        // Increase free memory pointer by lenght + 32
            mstore(0x40, add(add(result, length), 32))
        // Set result length
            mstore(result, length)
        }

        // Iterate over the data stepping by 32 bytes
        for (uint256 i = 0; i < length; i += 32) {
            // Generate hash of the key and offset
            bytes32 hash = keccak256(abi.encodePacked(key, i));

            bytes32 chunk;
            // solhint-disable-next-line no-inline-assembly
            assembly {
            // Read 32-bytes data chunk
                chunk := mload(add(data, add(i, 32)))
            }
            // XOR the chunk with hash
            chunk ^= hash;
            // solhint-disable-next-line no-inline-assembly
            assembly {
            // Write 32-byte encrypted chunk
                mstore(add(result, add(i, 32)), chunk)
            }
        }
    }

    /**
     *  @notice         Returns whether the relvant batch of NFTs is subject to a delayed reveal.
     *  @dev            Returns `true` if `_batchId`'s base URI is encrypted.
     *  @param _batchId ID of a batch of NFTs.
     */
    function isEncryptedBatch(uint256 _batchId) public view returns (bool) {
        return encryptedData[_batchId].length > 0;
    }
}

File 23 of 41 : IDelayedReveal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IDelayedReveal {
    event TokenURIRevealed(uint256 indexed index, string revealedURI);

    function reveal(uint256 identifier, bytes calldata key) external returns (string memory revealedURI);

    function encryptDecrypt(bytes memory data, bytes calldata key) external pure returns (bytes memory result);
}

File 24 of 41 : ILazyMint.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ILazyMint {
    event TokensLazyMinted(uint256 indexed startTokenId, uint256 endTokenId, string baseURI, bytes encryptedBaseURI);
}

File 25 of 41 : ISignatureAction.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ISignatureAction {
    /**
     *  @notice The payload that must be signed by an authorized wallet.
     *
     *  @param validityStartTimestamp The UNIX timestamp at and after which a signature is valid.
     *  @param validityEndTimestamp The UNIX timestamp at and after which a signature is invalid/expired.
     *  @param uid A unique non-repeatable ID for the payload.
     *  @param data Arbitrary bytes data to be used at the discretion of the contract.
     */
    struct GenericRequest {
        uint128 validityStartTimestamp;
        uint128 validityEndTimestamp;
        bytes32 uid;
        bytes data;
    }

    /// @notice Emitted when a payload is verified and executed.
    event RequestExecuted(address indexed user, address indexed signer, GenericRequest _req);

    /**
     *  @notice Verfies that a payload is signed by an authorized wallet.
     *
     *  @param req The payload signed by the authorized wallet.
     *  @param signature The signature produced by the authorized wallet signing the given payload.
     *
     *  @return success Whether the payload is signed by the authorized wallet.
     *  @return signer The address of the signer.
     */
    function verify(GenericRequest calldata req, bytes calldata signature)
    external
    view
    returns (bool success, address signer);
}

File 26 of 41 : LazyMint.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./interfaces/ILazyMint.sol";
import "./BatchMintMetadata.sol";

/**
 *  The `LazyMint` is a contract extension for any base NFT contract. It lets you 'lazy mint' any number of NFTs
 *  at once. Here, 'lazy mint' means defining the metadata for particular tokenIds of your NFT contract, without actually
 *  minting a non-zero balance of NFTs of those tokenIds.
 */

abstract contract LazyMint is ILazyMint, BatchMintMetadata {
    /// @notice The tokenId assigned to the next new NFT to be lazy minted.
    uint256 internal nextTokenIdToLazyMint;

    /**
     *  @notice                  Lets an authorized address lazy mint a given amount of NFTs.
     *
     *  @param _amount           The number of NFTs to lazy mint.
     *  @param _baseURIForTokens The base URI for the 'n' number of NFTs being lazy minted, where the metadata for each
     *                           of those NFTs is `${baseURIForTokens}/${tokenId}`.
     *  @param _data             Additional bytes data to be used at the discretion of the consumer of the contract.
     *  @return batchId          A unique integer identifier for the batch of NFTs lazy minted together.
     */
    function _lazyMint(
        uint256 _amount,
        string calldata _baseURIForTokens,
        bytes calldata _data
    ) internal returns (uint256 batchId) {

        if (_amount == 0) {
            revert("0 amt");
        }

        uint256 startId = nextTokenIdToLazyMint;

        (nextTokenIdToLazyMint, batchId) = _batchMintMetadata(startId, _amount, _baseURIForTokens);

        emit TokensLazyMinted(startId, startId + _amount - 1, _baseURIForTokens, _data);

        return batchId;
    }
}

File 27 of 41 : Petopia.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/metatx/ERC2771Context.sol";
import "@openzeppelin/contracts/utils/Multicall.sol";
import "@openzeppelin/contracts/token/common/ERC2981.sol";
import "erc721a/contracts/extensions/ERC721ABurnable.sol";
import "lib/dynamic-contracts/src/presets/BaseRouter.sol";
import "./SignatureAction.sol";
import "./DelayedReveal.sol";
import "./LazyMint.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract Petopia is
ERC721ABurnable,
AccessControl,
ERC2771Context,
ERC2981,
Multicall,
BaseRouter,
SignatureAction,
DelayedReveal,
LazyMint,
Ownable
{
    bytes32 private constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 private constant TRANSFER_ROLE = keccak256("TRANSFER_ROLE");

    mapping(uint256 => bytes32) private tokenIdOffset;
    /// @notice Emitted when tokens are claimed via `claimWithSignature`.
    event TokensClaimed(
        address indexed claimer,
        address indexed receiver,
        uint256 startTokenId,
        uint256 quantityClaimed
    );

    /*///////////////////////////////////////////////////////////////
                    Constructor and Initializer logic
    //////////////////////////////////////////////////////////////*/

    constructor(
        address _defaultAdmin,
        string memory _name,
        string memory _symbol,
        string memory _contractURI,
        address _royaltyRecipient,
        uint16 _royaltyBps,
        Extension[] memory _extensions,
        address _trustedForwarders
    )
    BaseRouter(_extensions)
    ERC2771Context(_trustedForwarders)
    ERC721A(_name, _symbol)
    Ownable(_defaultAdmin)
    {
        _baseContractURI = _contractURI;
        _setupRoles(_defaultAdmin);
        _setDefaultRoyalty(_royaltyRecipient, _royaltyBps);
    }

    function _setupRoles(address _defaultAdmin) internal {
        _setRoleAdmin(DEFAULT_ADMIN_ROLE, DEFAULT_ADMIN_ROLE);
        _setRoleAdmin(MINTER_ROLE, DEFAULT_ADMIN_ROLE);
        _setRoleAdmin(TRANSFER_ROLE, DEFAULT_ADMIN_ROLE);

        _grantRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);
        _grantRole(MINTER_ROLE, _defaultAdmin);
        _grantRole(TRANSFER_ROLE, address(0));
    }

    function mint(address to, uint quantity) external onlyRole(MINTER_ROLE) {
        uint256 tokenIdToMint = _nextTokenId();
        if (tokenIdToMint + quantity > nextTokenIdToLazyMint) {
            revert("!Tokens");
        }
        _mint(to, quantity);
    }

    /*///////////////////////////////////////////////////////////////
              Internal functions
    //////////////////////////////////////////////////////////////*/

    function _beforeTokenTransfers(
        address from,
        address to,
        uint startTokenId,
        uint quantity
    ) internal virtual override {
        super._beforeTokenTransfers(from, to, startTokenId, quantity);

        // if transfer is restricted on the contract, we still want to allow burning and minting
        if (!hasRole(TRANSFER_ROLE, address(0)) && from != address(0) && to != address(0)) {
            if (!hasRole(TRANSFER_ROLE, from) && !hasRole(TRANSFER_ROLE, to)) {
                revert("!TRANSFER");
            }
        }
    }

    function _canSetExtension() internal view virtual override returns (bool) {
        return hasRole(DEFAULT_ADMIN_ROLE, _msgSender());
    }

    function _isAuthorizedSigner(address _signer) internal view override returns (bool) {
        return hasRole(MINTER_ROLE, _signer);
    }

    /*///////////////////////////////////////////////////////////////
                   Lazy minting + delayed-reveal logic
   //////////////////////////////////////////////////////////////*

   /**
    *  @dev Lets an account with `MINTER_ROLE` lazy mint 'n' NFTs.
     *       The URIs for each token is the provided `_baseURIForTokens` + `{tokenId}`.
     */
    function lazyMint(
        uint256 _amount,
        string calldata _baseURIForTokens,
        bytes calldata _data
    ) external onlyRole(MINTER_ROLE) returns (uint256 batchId) {
        if (_data.length > 0) {
            (bytes memory encryptedURI, bytes32 provenanceHash) = abi.decode(_data, (bytes, bytes32));
            if (encryptedURI.length != 0 && provenanceHash != "") {
                _setEncryptedData(nextTokenIdToLazyMint + _amount, _data);
            }
        }

        return _lazyMint(_amount, _baseURIForTokens, _data);
    }

    function claimWithSignature(GenericRequest calldata _req, bytes calldata _signature)
    external
    returns (address signer)
    {
        (
            address to,
            uint256 quantity
        ) = abi.decode(_req.data, (address, uint256));

        if (quantity == 0) {
            revert("qty");
        }

        uint256 tokenIdToMint = _nextTokenId();
        if (tokenIdToMint + quantity > nextTokenIdToLazyMint) {
            revert("!Tokens");
        }
        // Verify and process payload.
        signer = _processRequest(_req, _signature);

        // Mint tokens.
        _mint(to, quantity);

        emit TokensClaimed(_msgSender(), to, tokenIdToMint, quantity);
    }

    /// @dev Lets an account with `MINTER_ROLE` reveal the URI for a batch of 'delayed-reveal' NFTs.
    function reveal(uint256 _index, bytes calldata _key)
    external
    onlyRole(MINTER_ROLE)
    returns (string memory revealedURI)
    {
        uint256 batchId = getBatchIdAtIndex(_index);
        revealedURI = getRevealURI(batchId, _key);

        _setEncryptedData(batchId, "");
        _setBaseURI(batchId, revealedURI);

        _scrambleOffset(batchId, _key);

        emit TokenURIRevealed(_index, revealedURI);
    }
    /*///////////////////////////////////////////////////////////////
                  Metadata, EIP 165 / 721 / 2981 / 2771 logic
    //////////////////////////////////////////////////////////////*/
    /// @dev Returns the URI for a given tokenId.
    function tokenURI(uint256 _tokenId) public view virtual override(ERC721A, IERC721A) returns (string memory) {
        (uint256 batchId,uint256 index) = _getBatchId(_tokenId);
        string memory batchUri = _getBaseURI(_tokenId);

        if (isEncryptedBatch(batchId)) {
            return string(abi.encodePacked(batchUri, "0"));
        } else {
            uint256 fairMetadataId = _getFairMetadataId(_tokenId, batchId, index);
            return string(abi.encodePacked(batchUri, _toString(fairMetadataId)));
        }
    }

    /// @dev Returns the fair metadata ID for a given tokenId.
    function _getFairMetadataId(
        uint256 _tokenId,
        uint256 _batchId,
        uint256 _indexOfBatchId
    ) private view returns (uint256 fairMetadataId) {
        bytes32 bytesRandom = tokenIdOffset[_batchId];
        if (bytesRandom == bytes32(0)) {
            return _tokenId;
        }

        uint256 randomness = uint256(bytesRandom);
        uint256 prevBatchId;
        if (_indexOfBatchId > 0) {
            prevBatchId = getBatchIdAtIndex(_indexOfBatchId - 1);
        }

        uint256 batchSize = _batchId - prevBatchId;
        uint256 offset = randomness % batchSize;
        fairMetadataId = prevBatchId + (_tokenId + offset) % batchSize;
    }

    string private _baseContractURI;

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

    function setContractURI(string memory _uri) public onlyRole(DEFAULT_ADMIN_ROLE) {
        _baseContractURI = _uri;
    }

    function setBaseURI(uint256 _batchId, string memory _baseURI) public onlyRole(DEFAULT_ADMIN_ROLE) {
        _setBaseURI(_batchId, _baseURI);
    }

    function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(AccessControl, ERC721A, IERC721A, ERC2981)
    returns (bool)
    {
        return ERC721A.supportsInterface(interfaceId) || AccessControl.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId);
    }

    /// @dev Scrambles tokenId offset for a given batchId.
    function _scrambleOffset(uint256 _batchId, bytes calldata _seed) private {
        tokenIdOffset[_batchId] = keccak256(abi.encodePacked(_seed, block.prevrandao, _msgSender(), block.timestamp, blockhash(block.number - 1)));
    }

    function setDefaultRoyalty(address receiver, uint96 feeNumerator)
    external
    onlyRole(DEFAULT_ADMIN_ROLE)
    {
        _setDefaultRoyalty(receiver, feeNumerator);
    }

    function setTokenRoyalty(
        uint tokenId,
        address receiver,
        uint96 feeNumerator
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        _setTokenRoyalty(tokenId, receiver, feeNumerator);
    }

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

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

    function _contextSuffixLength() internal view virtual override(ERC2771Context, Context) returns (uint) {
        return ERC2771Context._contextSuffixLength();
    }
}

File 28 of 41 : SignatureAction.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./interfaces/ISignatureAction.sol";

abstract contract SignatureAction is EIP712, ISignatureAction {
    using ECDSA for bytes32;

    bytes32 private constant TYPEHASH =
    keccak256("GenericRequest(uint128 validityStartTimestamp,uint128 validityEndTimestamp,bytes32 uid,bytes data)");

    /// @dev Mapping from a signed request UID => whether the request is processed.
    mapping(bytes32 => bool) private executed;

    constructor()
    EIP712("SignatureAction", "1")
    {}
    /// @dev Verifies that a request is signed by an authorized account.
    function verify(GenericRequest calldata _req, bytes calldata _signature)
    public
    view
    override
    returns (bool success, address signer)
    {
        signer = _recoverAddress(_req, _signature);
        success = !executed[_req.uid] && _isAuthorizedSigner(signer);
    }

    /// @dev Returns whether a given address is authorized to sign requests.
    function _isAuthorizedSigner(address _signer) internal view virtual returns (bool);

    /// @dev Verifies a request and marks the request as processed.
    function _processRequest(GenericRequest calldata _req, bytes calldata _signature)
    internal
    returns (address signer)
    {
        bool success;
        (success, signer) = verify(_req, _signature);

        if (!success) {
            revert("Invalid");
        }

        if (_req.validityStartTimestamp > block.timestamp || block.timestamp > _req.validityEndTimestamp) {
            revert("expired");
        }

        executed[_req.uid] = true;
    }

    /// @dev Returns the address of the signer of the request.
    function _recoverAddress(GenericRequest calldata _req, bytes calldata _signature) internal view returns (address) {
        return _hashTypedDataV4(keccak256(_encodeRequest(_req))).recover(_signature);
    }

    /// @dev Encodes a request for recovery of the signer in `recoverAddress`.
    function _encodeRequest(GenericRequest calldata _req) internal pure returns (bytes memory) {
        return
            abi.encode(
            TYPEHASH,
            _req.validityStartTimestamp,
            _req.validityEndTimestamp,
            _req.uid,
            keccak256(_req.data)
        );
    }
}

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

pragma solidity ^0.8.4;

import './IERC721A.sol';

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

/**
 * @title ERC721A
 *
 * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
 * Non-Fungible Token Standard, including the Metadata extension.
 * Optimized for lower gas during batch mints.
 *
 * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
 * starting from `_startTokenId()`.
 *
 * Assumptions:
 *
 * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721A is IERC721A {
    // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364).
    struct TokenApprovalRef {
        address value;
    }

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

    // Mask of an entry in packed address data.
    uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;

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

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

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

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

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

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

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

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

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

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

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

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

    // The `Transfer` event signature is given by:
    // `keccak256(bytes("Transfer(address,address,uint256)"))`.
    bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
        0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;

    // =============================================================
    //                            STORAGE
    // =============================================================

    // The next token ID to be minted.
    uint256 private _currentIndex;

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        // The interface IDs are constants representing the first 4 bytes
        // of the XOR of all function selectors in the interface.
        // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
        // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
        return
            interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
            interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
            interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
    }

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

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

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        if (!_exists(tokenId)) revert URIQueryForNonexistentToken();

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

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

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

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

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

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

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

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

        unchecked {
            if (_startTokenId() <= curr)
                if (curr < _currentIndex) {
                    uint256 packed = _packedOwnerships[curr];
                    // If not burned.
                    if (packed & _BITMASK_BURNED == 0) {
                        // Invariant:
                        // There will always be an initialized ownership slot
                        // (i.e. `ownership.addr != address(0) && ownership.burned == false`)
                        // before an unintialized ownership slot
                        // (i.e. `ownership.addr == address(0) && ownership.burned == false`)
                        // Hence, `curr` will not underflow.
                        //
                        // We can directly compare the packed value.
                        // If the address is zero, packed will be zero.
                        while (packed == 0) {
                            packed = _packedOwnerships[--curr];
                        }
                        return packed;
                    }
                }
        }
        revert OwnerQueryForNonexistentToken();
    }

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

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

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

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

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * 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) public payable virtual override {
        address owner = ownerOf(tokenId);

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

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

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

        return _tokenApprovals[tokenId].value;
    }

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom}
     * for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public payable virtual override {
        uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);

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

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

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

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

        _beforeTokenTransfers(from, to, tokenId, 1);

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token
     * by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement
     * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public payable virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

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

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

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

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

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

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

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

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

            uint256 toMasked;
            uint256 end = startTokenId + quantity;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        address from = address(uint160(prevOwnershipPacked));

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 30 of 41 : ERC721ABurnable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721ABurnable.sol';
import '../ERC721A.sol';

/**
 * @title ERC721ABurnable.
 *
 * @dev ERC721A token that can be irreversibly burned (destroyed).
 */
abstract contract ERC721ABurnable is ERC721A, IERC721ABurnable {
    /**
     * @dev Burns `tokenId`. See {ERC721A-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual override {
        _burn(tokenId, true);
    }
}

File 31 of 41 : IERC721ABurnable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import '../IERC721A.sol';

/**
 * @dev Interface of ERC721ABurnable.
 */
interface IERC721ABurnable is IERC721A {
    /**
     * @dev Burns `tokenId`. See {ERC721A-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) external;
}

File 32 of 41 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.3
// Creator: Chiru Labs

pragma solidity ^0.8.4;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Returns the total number of tokens in existence.
     * Burned tokens will reduce the count.
     * To get the total number of tokens minted, please see {_totalMinted}.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Emitted when tokens in `fromTokenId` to `toTokenId`
     * (inclusive) is transferred from `from` to `to`, as defined in the
     * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard.
     *
     * See {_mintERC2309} for more details.
     */
    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}

File 33 of 41 : Router.sol
// SPDX-License-Identifier: MIT
// @author: thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)

pragma solidity ^0.8.0;

import "../interfaces/IRouter.sol";

abstract contract Router is IRouter {

    fallback() external payable virtual {
    /// @dev delegate calls the appropriate implementation smart contract for a given function.
        address implementation = getImplementationForFunction(msg.sig);
        _delegate(implementation);
    }

    receive() external payable virtual {}

    /// @dev delegateCalls an `implementation` smart contract.
    function _delegate(address implementation) internal virtual {
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }

    /// @dev Unimplemented. Returns the implementation contract address for a given function signature.
    function getImplementationForFunction(bytes4 _functionSelector) public view virtual returns (address);
}

File 34 of 41 : IBaseRouter.sol
// SPDX-License-Identifier: MIT
// @author: thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)

pragma solidity ^0.8.0;

import "./IDefaultExtensionSet.sol";

interface IBaseRouter is IDefaultExtensionSet {
    /*///////////////////////////////////////////////////////////////
                        External functions
    //////////////////////////////////////////////////////////////*/

    /// @dev Adds a new extension to the router.
    function addExtension(Extension memory extension) external;

    /// @dev Updates an existing extension in the router, or overrides a default extension.
    function updateExtension(Extension memory extension) external;

    /// @dev Removes an existing extension from the router.
    function removeExtension(string memory extensionName) external;
}

File 35 of 41 : IDefaultExtensionSet.sol
// SPDX-License-Identifier: MIT
// @author: thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)

pragma solidity ^0.8.0;

import "./IExtension.sol";

interface IDefaultExtensionSet is IExtension {
    /*///////////////////////////////////////////////////////////////
                            View functions
    //////////////////////////////////////////////////////////////*/

    /// @dev Returns all extensions stored.
    function getAllExtensions() external view returns (Extension[] memory);

    /// @dev Returns all functions that belong to the given extension contract.
    function getAllFunctionsOfExtension(string memory extensionName) external view returns (ExtensionFunction[] memory);

    /// @dev Returns the extension metadata for a given function.
    function getExtensionForFunction(bytes4 functionSelector) external view returns (ExtensionMetadata memory);

    /// @dev Returns the extension's implementation smart contract address.
    function getExtensionImplementation(string memory extensionName) external view returns (address);

    /// @dev Returns the extension metadata and functions for a given extension.
    function getExtension(string memory extensionName) external view returns (Extension memory);
}

File 36 of 41 : IExtension.sol
// SPDX-License-Identifier: MIT
// @author: thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)

pragma solidity ^0.8.0;

interface IExtension {
    /*///////////////////////////////////////////////////////////////
                                Structs
    //////////////////////////////////////////////////////////////*/

    /**
     *  @notice A extension's metadata.
     *
     *  @param name             The unique name of the extension.
     *  @param metadataURI      The URI where the metadata for the extension lives.
     *  @param implementation   The implementation smart contract address of the extension.
     */
    struct ExtensionMetadata {
        string name;
        string metadataURI;
        address implementation;
    }

    /**
     *  @notice An interface to describe a extension's function.
     *
     *  @param functionSelector    The 4 byte selector of the function.
     *  @param functionSignature   Function signature as a string. E.g. "transfer(address,address,uint256)"
     */
    struct ExtensionFunction {
        bytes4 functionSelector;
        string functionSignature;
    }

    /**
     *  @notice An interface to describe an extension.
     *
     *  @param metadata     The extension's metadata; it's name, metadata URI and implementation contract address.
     *  @param functions    The functions that belong to the extension.
     */
    struct Extension {
        ExtensionMetadata metadata;
        ExtensionFunction[] functions;
    }

    /*///////////////////////////////////////////////////////////////
                                Events
    //////////////////////////////////////////////////////////////*/

    /// @dev Emitted when a extension is added; emitted for each function of the extension.
    event ExtensionAdded(address indexed extensionAddress, bytes4 indexed functionSelector, string functionSignature);

    /// @dev Emitted when extension is updated; emitted for each function of the extension.
    event ExtensionUpdated(
        address indexed oldExtensionAddress,
        address indexed newExtensionAddress,
        bytes4 indexed functionSelector,
        string functionSignature
    );

    /// @dev Emitted when a extension is removed; emitted for each function of the extension.
    event ExtensionRemoved(address indexed extensionAddress, bytes4 indexed functionSelector, string functionSignature);
}

File 37 of 41 : IRouter.sol
// SPDX-License-Identifier: MIT
// @author: thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)

pragma solidity ^0.8.0;

interface IRouter {
    fallback() external payable;
    receive() external payable;

    function getImplementationForFunction(bytes4 _functionSelector) external view returns (address);
}

File 38 of 41 : BaseRouter.sol
// SPDX-License-Identifier: MIT
// @author: thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)

pragma solidity ^0.8.0;

// Interface
import "../interfaces/IBaseRouter.sol";

// Core
import "../core/Router.sol";

// Utils
import "./utils/StringSet.sol";
import "./utils/DefaultExtensionSet.sol";
import "./utils/ExtensionState.sol";

abstract contract BaseRouter is IBaseRouter, Router, ExtensionState {
    using StringSet for StringSet.Set;

    /*///////////////////////////////////////////////////////////////
                            State variables
    //////////////////////////////////////////////////////////////*/

    /// @notice The DefaultExtensionSet that stores default extensions of the router.
    address public immutable defaultExtensionSet;

    /*///////////////////////////////////////////////////////////////
                                Constructor
    //////////////////////////////////////////////////////////////*/

    constructor(Extension[] memory _extensions) {

        DefaultExtensionSet map = new DefaultExtensionSet();
        defaultExtensionSet = address(map);

        uint256 len = _extensions.length;

        for (uint256 i = 0; i < len; i += 1) {
            map.setExtension(_extensions[i]);
        }
    }

    /*///////////////////////////////////////////////////////////////
                        External functions
    //////////////////////////////////////////////////////////////*/

    /// @dev Adds a new extension to the router.
    function addExtension(Extension memory _extension) external {
        require(_canSetExtension(), "BaseRouter: caller not authorized.");

        _addExtension(_extension);
    }

    /// @dev Updates an existing extension in the router, or overrides a default extension.
    function updateExtension(Extension memory _extension) external {
        require(_canSetExtension(), "BaseRouter: caller not authorized.");

        _updateExtension(_extension);
    }

    /// @dev Removes an existing extension from the router.
    function removeExtension(string memory _extensionName) external {
        require(_canSetExtension(), "BaseRouter: caller not authorized.");

        _removeExtension(_extensionName);
    }

    /*///////////////////////////////////////////////////////////////
                            View functions
    //////////////////////////////////////////////////////////////*/

    /**
     *  @notice Returns all extensions stored. Override default lugins stored in router are
     *          given precedence over default extensions in DefaultExtensionSet.
     */
    function getAllExtensions() external view returns (Extension[] memory allExtensions) {
        Extension[] memory defaultExtensions = IDefaultExtensionSet(defaultExtensionSet).getAllExtensions();
        uint256 defaultExtensionsLen = defaultExtensions.length;

        ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage();
        string[] memory names = data.extensionNames.values();
        uint256 namesLen = names.length;

        uint256 overrides = 0;
        for (uint256 i = 0; i < defaultExtensionsLen; i += 1) {
            if (data.extensionNames.contains(defaultExtensions[i].metadata.name)) {
                overrides += 1;
            }
        }

        uint256 total = (namesLen + defaultExtensionsLen) - overrides;

        allExtensions = new Extension[](total);
        uint256 idx = 0;

        for (uint256 i = 0; i < defaultExtensionsLen; i += 1) {
            string memory name = defaultExtensions[i].metadata.name;
            if (!data.extensionNames.contains(name)) {
                allExtensions[idx] = defaultExtensions[i];
                idx += 1;
            }
        }

        for (uint256 i = 0; i < namesLen; i += 1) {
            allExtensions[idx] = data.extensions[names[i]];
            idx += 1;
        }
    }

    /// @dev Returns the extension metadata and functions for a given extension.
    function getExtension(string memory _extensionName) public view returns (Extension memory) {
        ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage();
        bool isLocalExtension = data.extensionNames.contains(_extensionName);

        return isLocalExtension ? data.extensions[_extensionName] : IDefaultExtensionSet(defaultExtensionSet).getExtension(_extensionName);
    }

    /// @dev Returns the extension's implementation smart contract address.
    function getExtensionImplementation(string memory _extensionName) external view returns (address) {
        return getExtension(_extensionName).metadata.implementation;
    }

    /// @dev Returns all functions that belong to the given extension contract.
    function getAllFunctionsOfExtension(string memory _extensionName) external view returns (ExtensionFunction[] memory) {
        return getExtension(_extensionName).functions;
    }

    /// @dev Returns the extension metadata for a given function.
    function getExtensionForFunction(bytes4 _functionSelector) public view returns (ExtensionMetadata memory) {
        ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage();
        ExtensionMetadata memory metadata = data.extensionMetadata[_functionSelector];

        bool isLocalExtension = metadata.implementation != address(0);

        return isLocalExtension ? metadata : IDefaultExtensionSet(defaultExtensionSet).getExtensionForFunction(_functionSelector);
    }

    /// @dev Returns the extension implementation address stored in router, for the given function.
    function getImplementationForFunction(bytes4 _functionSelector)
        public
        view
        override
        returns (address extensionAddress)
    {
        return getExtensionForFunction(_functionSelector).implementation;
    }

    /*///////////////////////////////////////////////////////////////
                        Internal functions
    //////////////////////////////////////////////////////////////*/

    /// @dev Returns whether a extension can be set in the given execution context.
    function _canSetExtension() internal view virtual returns (bool);
}

File 39 of 41 : DefaultExtensionSet.sol
// SPDX-License-Identifier: MIT
// @author: thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)

pragma solidity ^0.8.0;

// Interface
import "../../interfaces/IDefaultExtensionSet.sol";

// Extensions
import "./ExtensionState.sol";

contract DefaultExtensionSet is IDefaultExtensionSet, ExtensionState {
    using StringSet for StringSet.Set;

    /*///////////////////////////////////////////////////////////////
                            State variables
    //////////////////////////////////////////////////////////////*/

    /// @notice The deployer of DefaultExtensionSet.
    address private deployer;

    /*///////////////////////////////////////////////////////////////
                            Constructor
    //////////////////////////////////////////////////////////////*/

    constructor() {
        deployer = msg.sender;
    }

    /*///////////////////////////////////////////////////////////////
                            External functions
    //////////////////////////////////////////////////////////////*/

    /// @notice Stores a extension in the DefaultExtensionSet.
    function setExtension(Extension memory _extension) external {
        require(msg.sender == deployer, "DefaultExtensionSet: unauthorized caller.");
        _addExtension(_extension);
    }

    /*///////////////////////////////////////////////////////////////
                            View functions
    //////////////////////////////////////////////////////////////*/

    /// @notice Returns all extensions stored.
    function getAllExtensions() external view returns (Extension[] memory allExtensions) {
        ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage();

        string[] memory names = data.extensionNames.values();
        uint256 len = names.length;

        allExtensions = new Extension[](len);

        for (uint256 i = 0; i < len; i += 1) {
            allExtensions[i] = data.extensions[names[i]];
        }
    }

    /// @notice Returns the extension metadata and functions for a given extension.
    function getExtension(string memory _extensionName) public view returns (Extension memory) {
        ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage();
        require(data.extensionNames.contains(_extensionName), "DefaultExtensionSet: extension does not exist.");
        return data.extensions[_extensionName];
    }

    /// @notice Returns the extension's implementation smart contract address.
    function getExtensionImplementation(string memory _extensionName) external view returns (address) {
        return getExtension(_extensionName).metadata.implementation;
    }

    /// @notice Returns all functions that belong to the given extension contract.
    function getAllFunctionsOfExtension(string memory _extensionName) external view returns (ExtensionFunction[] memory) {
        return getExtension(_extensionName).functions;
    }

    /// @notice Returns the extension metadata for a given function.
    function getExtensionForFunction(bytes4 _functionSelector) external view returns (ExtensionMetadata memory) {
        ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage();
        ExtensionMetadata memory metadata = data.extensionMetadata[_functionSelector];
        require(metadata.implementation != address(0), "DefaultExtensionSet: no extension for function.");
        return metadata;
    }
}

File 40 of 41 : ExtensionState.sol
// SPDX-License-Identifier: MIT
// @author: thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)

pragma solidity ^0.8.0;

// Interface
import "../../interfaces/IExtension.sol";

// Extensions
import "./StringSet.sol";

library ExtensionStateStorage {
    bytes32 public constant EXTENSION_STATE_STORAGE_POSITION = keccak256("extension.state.storage");

    struct Data {
        /// @dev Set of names of all extensions stored.
        StringSet.Set extensionNames;
        /// @dev Mapping from extension name => `Extension` i.e. extension metadata and functions.
        mapping(string => IExtension.Extension) extensions;
        /// @dev Mapping from function selector => extension metadata of the extension the function belongs to.
        mapping(bytes4 => IExtension.ExtensionMetadata) extensionMetadata;
    }

    function extensionStateStorage() internal pure returns (Data storage extensionStateData) {
        bytes32 position = EXTENSION_STATE_STORAGE_POSITION;
        assembly {
            extensionStateData.slot := position
        }
    }
}

contract ExtensionState is IExtension {
    using StringSet for StringSet.Set;

    /*///////////////////////////////////////////////////////////////
                        Internal functions
    //////////////////////////////////////////////////////////////*/

    /// @dev Stores a new extension in the contract.
    function _addExtension(Extension memory _extension) internal {
        ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage();

        string memory name = _extension.metadata.name;

        require(data.extensionNames.add(name), "ExtensionState: extension already exists.");
        data.extensions[name].metadata = _extension.metadata;

        require(_extension.metadata.implementation != address(0), "ExtensionState: adding extension without implementation.");

        uint256 len = _extension.functions.length;
        for (uint256 i = 0; i < len; i += 1) {
            require(
                _extension.functions[i].functionSelector ==
                    bytes4(keccak256(abi.encodePacked(_extension.functions[i].functionSignature))),
                "ExtensionState: fn selector and signature mismatch."
            );
            require(
                data.extensionMetadata[_extension.functions[i].functionSelector].implementation == address(0),
                "ExtensionState: extension already exists for function."
            );

            data.extensionMetadata[_extension.functions[i].functionSelector] = _extension.metadata;
            data.extensions[name].functions.push(_extension.functions[i]);

            emit ExtensionAdded(
                _extension.metadata.implementation,
                _extension.functions[i].functionSelector,
                _extension.functions[i].functionSignature
            );
        }
    }

    /// @dev Updates / overrides an existing extension in the contract.
    function _updateExtension(Extension memory _extension) internal {
        ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage();

        string memory name = _extension.metadata.name;
        require(data.extensionNames.contains(name), "ExtensionState: extension does not exist.");

        address oldImplementation = data.extensions[name].metadata.implementation;
        require(_extension.metadata.implementation != oldImplementation, "ExtensionState: re-adding same extension.");

        data.extensions[name].metadata = _extension.metadata;

        ExtensionFunction[] memory oldFunctions = data.extensions[name].functions;
        uint256 oldFunctionsLen = oldFunctions.length;

        delete data.extensions[name].functions;

        for (uint256 i = 0; i < oldFunctionsLen; i += 1) {
            delete data.extensionMetadata[oldFunctions[i].functionSelector];
        }

        uint256 len = _extension.functions.length;
        for (uint256 i = 0; i < len; i += 1) {
            require(
                _extension.functions[i].functionSelector ==
                    bytes4(keccak256(abi.encodePacked(_extension.functions[i].functionSignature))),
                "ExtensionState: fn selector and signature mismatch."
            );

            data.extensionMetadata[_extension.functions[i].functionSelector] = _extension.metadata;
            data.extensions[name].functions.push(_extension.functions[i]);

            emit ExtensionUpdated(
                oldImplementation,
                _extension.metadata.implementation,
                _extension.functions[i].functionSelector,
                _extension.functions[i].functionSignature
            );
        }
    }

    /// @dev Removes an existing extension from the contract.
    function _removeExtension(string memory _extensionName) internal {
        ExtensionStateStorage.Data storage data = ExtensionStateStorage.extensionStateStorage();

        require(data.extensionNames.remove(_extensionName), "ExtensionState: extension does not exist.");

        address implementation = data.extensions[_extensionName].metadata.implementation;
        ExtensionFunction[] memory extensionFunctions = data.extensions[_extensionName].functions;
        delete data.extensions[_extensionName];

        uint256 len = extensionFunctions.length;
        for (uint256 i = 0; i < len; i += 1) {
            emit ExtensionRemoved(
                implementation,
                extensionFunctions[i].functionSelector,
                extensionFunctions[i].functionSignature
            );
            delete data.extensionMetadata[extensionFunctions[i].functionSelector];
        }
    }
}

File 41 of 41 : StringSet.sol
// SPDX-License-Identifier: Apache 2.0
// @author: thirdweb (https://github.com/thirdweb-dev/dynamic-contracts)

pragma solidity ^0.8.0;

library StringSet {
    struct Set {
        // Storage of set values
        string[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(string => 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, string memory 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, string memory 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) {
                string memory 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, string memory 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 (string memory) {
        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 (string[] memory) {
        return set._values;
    }

    /**
     * @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, string memory value) internal returns (bool) {
        return _add(set, 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(Set storage set, string memory value) internal returns (bool) {
        return _remove(set, value);
    }

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

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

    /**
     * @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) internal view returns (string memory) {
        return _at(set, 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) internal view returns (string[] memory) {
        return _values(set);
    }
}

Settings
{
  "metadata": {
    "bytecodeHash": "none"
  },
  "optimizer": {
    "enabled": true,
    "runs": 20
  },
  "viaIR": true,
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_defaultAdmin","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_contractURI","type":"string"},{"internalType":"address","name":"_royaltyRecipient","type":"address"},{"internalType":"uint16","name":"_royaltyBps","type":"uint16"},{"components":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"metadataURI","type":"string"},{"internalType":"address","name":"implementation","type":"address"}],"internalType":"struct IExtension.ExtensionMetadata","name":"metadata","type":"tuple"},{"components":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"},{"internalType":"string","name":"functionSignature","type":"string"}],"internalType":"struct IExtension.ExtensionFunction[]","name":"functions","type":"tuple[]"}],"internalType":"struct IExtension.Extension[]","name":"_extensions","type":"tuple[]"},{"internalType":"address","name":"_trustedForwarders","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidDefaultRoyalty","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidDefaultRoyaltyReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"name":"ERC2981InvalidTokenRoyalty","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC2981InvalidTokenRoyaltyReceiver","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"extensionAddress","type":"address"},{"indexed":true,"internalType":"bytes4","name":"functionSelector","type":"bytes4"},{"indexed":false,"internalType":"string","name":"functionSignature","type":"string"}],"name":"ExtensionAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"extensionAddress","type":"address"},{"indexed":true,"internalType":"bytes4","name":"functionSelector","type":"bytes4"},{"indexed":false,"internalType":"string","name":"functionSignature","type":"string"}],"name":"ExtensionRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldExtensionAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newExtensionAddress","type":"address"},{"indexed":true,"internalType":"bytes4","name":"functionSelector","type":"bytes4"},{"indexed":false,"internalType":"string","name":"functionSignature","type":"string"}],"name":"ExtensionUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"MetadataFrozen","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"signer","type":"address"},{"components":[{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"indexed":false,"internalType":"struct ISignatureAction.GenericRequest","name":"_req","type":"tuple"}],"name":"RequestExecuted","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":true,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":false,"internalType":"string","name":"revealedURI","type":"string"}],"name":"TokenURIRevealed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"claimer","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantityClaimed","type":"uint256"}],"name":"TokensClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"startTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"baseURI","type":"string"},{"indexed":false,"internalType":"bytes","name":"encryptedBaseURI","type":"bytes"}],"name":"TokensLazyMinted","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"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"metadataURI","type":"string"},{"internalType":"address","name":"implementation","type":"address"}],"internalType":"struct IExtension.ExtensionMetadata","name":"metadata","type":"tuple"},{"components":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"},{"internalType":"string","name":"functionSignature","type":"string"}],"internalType":"struct IExtension.ExtensionFunction[]","name":"functions","type":"tuple[]"}],"internalType":"struct IExtension.Extension","name":"_extension","type":"tuple"}],"name":"addExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"batchFrozen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ISignatureAction.GenericRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"claimWithSignature","outputs":[{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultExtensionSet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"key","type":"bytes"}],"name":"encryptDecrypt","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"encryptedData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllExtensions","outputs":[{"components":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"metadataURI","type":"string"},{"internalType":"address","name":"implementation","type":"address"}],"internalType":"struct IExtension.ExtensionMetadata","name":"metadata","type":"tuple"},{"components":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"},{"internalType":"string","name":"functionSignature","type":"string"}],"internalType":"struct IExtension.ExtensionFunction[]","name":"functions","type":"tuple[]"}],"internalType":"struct IExtension.Extension[]","name":"allExtensions","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_extensionName","type":"string"}],"name":"getAllFunctionsOfExtension","outputs":[{"components":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"},{"internalType":"string","name":"functionSignature","type":"string"}],"internalType":"struct IExtension.ExtensionFunction[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBaseURICount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getBatchIdAtIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_extensionName","type":"string"}],"name":"getExtension","outputs":[{"components":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"metadataURI","type":"string"},{"internalType":"address","name":"implementation","type":"address"}],"internalType":"struct IExtension.ExtensionMetadata","name":"metadata","type":"tuple"},{"components":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"},{"internalType":"string","name":"functionSignature","type":"string"}],"internalType":"struct IExtension.ExtensionFunction[]","name":"functions","type":"tuple[]"}],"internalType":"struct IExtension.Extension","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_functionSelector","type":"bytes4"}],"name":"getExtensionForFunction","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"metadataURI","type":"string"},{"internalType":"address","name":"implementation","type":"address"}],"internalType":"struct IExtension.ExtensionMetadata","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_extensionName","type":"string"}],"name":"getExtensionImplementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_functionSelector","type":"bytes4"}],"name":"getImplementationForFunction","outputs":[{"internalType":"address","name":"extensionAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_batchId","type":"uint256"},{"internalType":"bytes","name":"_key","type":"bytes"}],"name":"getRevealURI","outputs":[{"internalType":"string","name":"revealedURI","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":[{"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":"uint256","name":"_batchId","type":"uint256"}],"name":"isEncryptedBatch","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":"_amount","type":"uint256"},{"internalType":"string","name":"_baseURIForTokens","type":"string"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"lazyMint","outputs":[{"internalType":"uint256","name":"batchId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_extensionName","type":"string"}],"name":"removeExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"bytes","name":"_key","type":"bytes"}],"name":"reveal","outputs":[{"internalType":"string","name":"revealedURI","type":"string"}],"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":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","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":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_batchId","type":"uint256"},{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setTokenRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"metadataURI","type":"string"},{"internalType":"address","name":"implementation","type":"address"}],"internalType":"struct IExtension.ExtensionMetadata","name":"metadata","type":"tuple"},{"components":[{"internalType":"bytes4","name":"functionSelector","type":"bytes4"},{"internalType":"string","name":"functionSignature","type":"string"}],"internalType":"struct IExtension.ExtensionFunction[]","name":"functions","type":"tuple[]"}],"internalType":"struct IExtension.Extension","name":"_extension","type":"tuple"}],"name":"updateExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint128","name":"validityStartTimestamp","type":"uint128"},{"internalType":"uint128","name":"validityEndTimestamp","type":"uint128"},{"internalType":"bytes32","name":"uid","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ISignatureAction.GenericRequest","name":"_req","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"verify","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"address","name":"signer","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101a060405234620008eb57620077f1803803809162000022826101a062000d5a565b6101a0396101008112620008eb576200003d6101a062000d7e565b6101c0519091906001600160401b038111620008eb576200006890826101a001906101a00162000db8565b6101e0519092906001600160401b038111620008eb576200009390836101a001906101a00162000db8565b610200519091906001600160401b038111620008eb57620000be90846101a001906101a00162000db8565b93620000cc61022062000d7e565b9260a06101a001519461ffff86168603620008eb5761026051906001600160401b038211620008eb576101a081016101bf83011215620008eb57816101a00151620001178162000e13565b9262000127604051948562000d5a565b81845260208401906101a084016101c0600585901b83010111620008eb576101c08101915b6101c0600585901b830101831062000b145750505050506200017360e06101a00162000d7e565b60405192620001828462000d3e565b600f84526e29b4b3b730ba3ab932a0b1ba34b7b760891b602085015260405194620001ad8662000d3e565b60018652603160f81b60208701528051906001600160401b0382116200073b5760025490600182811c9216801562000b09575b60208310146200071a5781601f84931162000aa8575b50602090601f831160011462000a2a5760009262000a1e575b50508160011b916000199060031b1c1916176002555b8051906001600160401b0382116200073b5760035490600182811c9216801562000a13575b60208310146200071a5781601f849311620009a1575b50602090601f8311600114620009125760009262000906575b50508160011b916000199060031b1c1916176003555b6000805560805260405161121c8082016001600160401b038111838210176200073b57829162006555833903906000f0801562000891576001600160a01b03811660a05281519160005b8381106200076c5750505050620002f08162000e52565b61016052620002ff8262000fe0565b61018052602081519101209081610120526020815191012080610140524660e052604051917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020840152604083015260608201524660808201523060a082015260a081528060c081011060018060401b0360c0830111176200073b5760c081810160405281516020830120905230610100526001600160a01b038216908115620007515750601380546001600160a01b0319811683179091556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a383516001600160401b0381116200073b57601554600181811c9116801562000730575b60208210146200071a57601f8111620006c1575b506020601f8211600114620006415781906200051a94959660009262000635575b50508160011b916000199060031b1c1916176015555b600080805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c88054908290557fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff90829081838180a481600080516020620077d183398151915280825260016040832001908282549255838380a47f8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c808352600160408420019183835493558380a4620005138162001137565b50620011c5565b506200052562001264565b506127108061ffff8416116200061357506001600160a01b0316908115620005fa57604051620005558162000d3e565b82815261ffff821660209091015260a01b61ffff60a01b16176009556040516151e890816200136d82396080518181816111ad0152818161157001526139eb015260a051818181610a1201528181610feb015281816149880152614aa3015260c05181613dfa015260e05181613eb501526101005181613dc401526101205181613e4901526101405181613e6f01526101605181611648015261018051816116710152f35b604051635b6cc80560e11b815260006004820152602490fd5b8260449161ffff60405192636f483d0960e01b84521660048301526024820152fd5b0151905038806200043f565b60156000908152600080516020620077b18339815191529690601f198416905b818110620006a85750916200051a959697918460019594106200068e575b505050811b0160155562000455565b015160001960f88460031b161c191690553880806200067f565b8383015189556001909801976020938401930162000661565b6015600052600080516020620077b1833981519152601f830160051c810191602084106200070f575b601f0160051c01905b8181106200070257506200041e565b60008155600101620006f3565b9091508190620006ea565b634e487b7160e01b600052602260045260246000fd5b90607f16906200040a565b634e487b7160e01b600052604160045260246000fd5b60c0602491631e4fbdf760e01b82820152600060c482015201fd5b8151811015620008f057600581901b8201602001516001600160a01b0384163b15620008eb57604051809163fdc9f25760e01b825260206004830152602081519160406024850152620007e6620007d084516060606488015260c487019062000e2b565b8484015186820360631901608488015262000e2b565b6040909301516001600160a01b031660a485015201518282036023190160448401528051808352600581901b830160209081019392810192908101919060005b8281106200089d575050505050908060009203818360018060a01b0389165af18015620008915762000878575b506001810180911115620002d9575b634e487b7160e01b600052601160045260246000fd5b6001600160401b0381116200073b576040523862000853565b6040513d6000823e3d90fd5b919395509193602080620008d8600193601f198782030189526040838b5163ffffffff60e01b81511684520151918185820152019062000e2b565b9701950191019186959493919262000826565b600080fd5b634e487b7160e01b600052603260045260246000fd5b01519050388062000279565b6003600090815293507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b91905b601f198416851062000985576001945083601f198116106200096b575b505050811b016003556200028f565b015160001960f88460031b161c191690553880806200095c565b818101518355602094850194600190930192909101906200093f565b60036000529091507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f840160051c81016020851062000a0b575b90849392915b601f830160051c82018110620009fb57505062000260565b60008155859450600101620009e3565b5080620009dd565b91607f16916200024a565b0151905038806200020f565b6002600090815293506000805160206200779183398151915291905b601f198416851062000a8c576001945083601f1981161062000a72575b505050811b0160025562000225565b015160001960f88460031b161c1916905538808062000a63565b8181015183556020948501946001909301929091019062000a46565b600260005290915060008051602062007791833981519152601f840160051c81016020851062000b01575b90849392915b601f830160051c8201811062000af1575050620001f6565b6000815585945060010162000ad9565b508062000ad3565b91607f1691620001e0565b82516001600160401b038111620008eb57601f199083016101a08101906040908803830112620008eb576040519162000b4d8362000d3e565b60208201516001600160401b038111620008eb57606090830191828a6101a001030112620008eb5760405190606082016001600160401b0381118382101762000d295760405260208101516001600160401b038111620008eb5762000bbd9060208b6101a0019184010162000db8565b825260408101516001600160401b038111620008eb5762000bfc9162000bf060609260208d6101a0019184010162000db8565b60208501520162000d7e565b60408201528252604081015160018060401b038111620008eb57876101a001603f828401011215620008eb576020818301015162000c3a8162000e13565b9262000c4a604051948562000d5a565b81845260208401928a6101a00160408460051b838501010111620008eb57604081830101935b60408460051b8385010101851062000c9e57505050505060208281019190915290825292830192016200014c565b84516001600160401b038111620008eb57838301016040610160828f030112620008eb576040519162000cd18362000d3e565b60408201516001600160e01b031981168103620008eb5783526060820151926001600160401b038411620008eb5762000d198f93604060209687966101a00192010162000db8565b8382015281520194019362000c70565b60246000634e487b7160e01b81526041600452fd5b604081019081106001600160401b038211176200073b57604052565b601f909101601f19168101906001600160401b038211908210176200073b57604052565b51906001600160a01b0382168203620008eb57565b60005b83811062000da75750506000910152565b818101518382015260200162000d96565b81601f82011215620008eb5780516001600160401b0381116200073b576040519262000def601f8301601f19166020018562000d5a565b81845260208284010111620008eb5762000e10916020808501910162000d93565b90565b6001600160401b0381116200073b5760051b60200190565b9060209162000e468151809281855285808601910162000d93565b601f01601f1916010190565b80516020908181101562000eb65750601f82511162000e8e578082519201519080831062000e7f57501790565b82600019910360031b1b161790565b62000eb260405192839263305a27a960e01b84526004840152602483019062000e2b565b0390fd5b906001600160401b0382116200073b57600b54926001938481811c9116801562000fd5575b838210146200071a57601f811162000f9b575b5081601f841160011462000f2f575092829391839260009462000f23575b50501b916000199060031b1c191617600b5560ff90565b01519250388062000f0c565b919083601f198116600b60005284600020946000905b8883831062000f80575050501062000f66575b505050811b01600b5560ff90565b015160001960f88460031b161c1916905538808062000f58565b85870151885590960195948501948793509081019062000f45565b600b60005284601f84600020920160051c820191601f860160051c015b82811062000fc857505062000eee565b6000815501859062000fb8565b90607f169062000edb565b8051602090818110156200100d5750601f82511162000e8e578082519201519080831062000e7f57501790565b906001600160401b0382116200073b57600c54926001938481811c911680156200112c575b838210146200071a57601f8111620010f2575b5081601f84116001146200108657509282939183926000946200107a575b50501b916000199060031b1c191617600c5560ff90565b01519250388062001063565b919083601f198116600c60005284600020946000905b88838310620010d75750505010620010bd575b505050811b01600c5560ff90565b015160001960f88460031b161c19169055388080620010af565b8587015188559096019594850194879350908101906200109c565b600c60005284601f84600020920160051c820191601f860160051c015b8281106200111f57505062001045565b600081550185906200110f565b90607f169062001032565b6001600160a01b0390811660008181527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c7602052604081205490929060ff16620011c05782805260086020526040832082845260205260408320600160ff19825416179055620011a66200132d565b1691600080516020620077718339815191528180a4600190565b505090565b6001600160a01b0390811660008181527f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb60205260408120549092600080516020620077d18339815191529160ff166200125e57600080516020620077718339815191529082855260086020526040852084865260205260408520600160ff19825416179055620012556200132d565b169380a4600190565b50505090565b60008080527f85da32aea425a83be1133c4e958580985fa04602ddf03ad35008a70703b20eb76020527fe3eaa97df54d66938ed55b4ec3f8335ad12a29512079af854e696c4d6dedf274547f8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c919060ff1662001328578181526008602090815260408083208380529091528120805460ff191660011790556001600160a01b036200130e6200132d565b1691600080516020620077718339815191528280a4600190565b905090565b6080516001600160a01b031633148062001360575b156200135c57601319360136811162000862573560601c90565b3390565b5060143610156200134256fe60806040526004361015610015575b3661444657005b60003560e01c8063012b87291461039557806301ffc9a71461039057806304634d8d1461038b57806306fdde0314610386578063081812fc14610381578063095ea7b31461037c57806318160ddd146103775780631ee8b41b14610372578063212f69121461036d57806323b872dd146103685780632419f51b14610363578063248a9ca31461035e5780632a55205a146103595780632f2ff15d1461035457806333cfcb9f1461034f57806336568abe1461034a57806340c10f191461034557806342842e0e1461034057806342966c681461033b578063492e224b146103365780634a00cc4814610331578063572b6c051461032c5780635944c753146103275780636352211e1461032257806363b45e2d1461031d57806370a0823114610318578063715018a6146103135780637a70a8951461030e5780637c3b1137146103095780637da0a8771461030457806383040532146102ff57806384b0196e146102fa5780638da5cb5b146102f557806391d14854146102f0578063938e3d7b146102eb57806395d89b41146102e65780639fc4d68f146102e1578063a05112fc146102dc578063a217fddf146102d7578063a22cb465146102d2578063ac9650d8146102cd578063b88d4fde146102c8578063c22707ee146102c3578063c4376dd7146102be578063c54c07e1146102b9578063c87b56dd146102b4578063ce0b6013146102af578063ce805642146102aa578063d37c353b146102a5578063d547741f146102a0578063e05688fe1461029b578063e715032214610296578063e8a3d48514610291578063e985e9c51461028c578063ee7d2adf146102875763f2fde38b0361000e576127ff565b612717565b6126cb565b612627565b6125d0565b612419565b6123d7565b612209565b612102565b6120c3565b6120a4565b611e66565b611c92565b611c6a565b611c19565b611bb4565b611acc565b611ab0565b611a73565b61195f565b61188c565b611792565b61174e565b611725565b61162d565b6115fc565b61155a565b611531565b611439565b611363565b611304565b6112e6565b6112b7565b6111d4565b611180565b610fc4565b610ea3565b610d6f565b610d4c565b610cd2565b610c7d565b610c3a565b610bf8565b610b4e565b610b1f565b610af9565b610ae7565b610a7f565b6109fc565b6109d9565b610930565b6108b9565b6107dd565b6106e4565b6105df565b610538565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b038211176103cb57604052565b61039a565b606081019081106001600160401b038211176103cb57604052565b602081019081106001600160401b038211176103cb57604052565b60c081019081106001600160401b038211176103cb57604052565b90601f801991011681019081106001600160401b038211176103cb57604052565b6040519061044f826103b0565b565b6001600160401b0381116103cb57601f01601f191660200190565b92919261047882610451565b916104866040519384610421565b8294818452818301116104a3578281602093846000960137010152565b600080fd5b9080601f830112156104a3578160206104c39335910161046c565b90565b60206003198201126104a357600435906001600160401b0382116104a3576104c3916004016104a8565b60005b8381106105035750506000910152565b81810151838201526020016104f3565b9060209161052c815180928185528580860191016104f0565b601f01601f1916010190565b346104a35760208061055161054c366104c6565b61493d565b01519060409182519180830181845282518091528484019180868360051b8701019401926000965b8388106105865786860387f35b909192939483806105bc600193603f198b820301875285838b5163ffffffff60e01b815116845201519181858201520190610513565b970193019701969093929193610579565b6001600160e01b03198116036104a357565b346104a35760203660031901126104a3576106466004356105ff816105cd565b6001600160e01b031981166301ffc9a760e01b811491908215610696575b8215610685575b8215610674575b821561064a575b505060405190151581529081906020820190565b0390f35b63152a902d60e11b1491508115610664575b503880610632565b61066e9150613988565b3861065c565b915061067f81613988565b9161062b565b635b5e139f60e01b81149250610624565b6380ac58cd60e01b8114925061061d565b6001600160a01b038116036104a357565b602435906001600160601b03821682036104a357565b604435906001600160601b03821682036104a357565b346104a35760403660031901126104a357600435610701816106a7565b6107096106b8565b90610712612931565b6001600160601b0382166127108082116107ae5750506001600160a01b038116156107915761076861078f92610758610749610442565b6001600160a01b039094168452565b6001600160601b03166020830152565b805160209091015160a01b6001600160a01b0319166001600160a01b039190911617600955565b005b604051635b6cc80560e11b815260006004820152602490fd5b0390fd5b6044925060405191636f483d0960e01b835260048301526024820152fd5b9060206104c3928181520190610513565b346104a3576000806003193601126108b657604051816002546107ff816119a3565b8084529060019081811690811561088e5750600114610835575b6106468461082981880382610421565b604051918291826107cc565b60028352602094507f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b82841061087b5750505081610646936108299282010193610819565b805485850187015292850192810161085f565b61064696506108299450602092508593915060ff191682840152151560051b82010193610819565b80fd5b346104a35760203660031901126104a357600435600054811080610914575b15610902576000908152600660209081526040918290205491516001600160a01b03909216825290f35b6040516333d1c03960e21b8152600490fd5b50600081815260046020526040902054600160e01b16156108d8565b60403660031901126104a357600435610948816106a7565b6024356001600160a01b038061095d83613edb565b16908133036109a8575b600093838552600660205261097f8160408720612b89565b16907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258480a480f35b81600052600760205260ff6109c13360406000206128bf565b5416610967576040516367d9dca160e11b8152600490fd5b346104a35760003660031901126104a35760206000546001549003604051908152f35b346104a35760003660031901126104a3576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b906040610a6c610a5a8451606085526060850190610513565b60208501518482036020860152610513565b928101516001600160a01b031691015290565b346104a35760203660031901126104a357610646610aa7600435610aa2816105cd565b614a41565b604051918291602083526020830190610a41565b60609060031901126104a357600435610ad3816106a7565b90602435610ae0816106a7565b9060443590565b61078f610af336610abb565b91613f4a565b346104a35760203660031901126104a3576020610b17600435613097565b604051908152f35b346104a35760203660031901126104a35760043560005260086020526020600160406000200154604051908152f35b346104a35760403660031901126104a357600435600052600a602052604060002060405190610b7c826103b0565b546001600160a01b03811680835260a09190911c602083015215610bea575b6020810151610bce9061271090610bbd906001600160601b0316602435612be4565b92519204916001600160a01b031690565b604080516001600160a01b039290921682526020820192909252f35b50610bf3612ba8565b610b9b565b346104a35760403660031901126104a35761078f602435600435610c1b826106a7565b806000526008602052610c35600160406000200154612a33565b612a55565b346104a35760403660031901126104a3576024356001600160401b0381116104a357610c6d61078f9136906004016104a8565b610c75612931565b6004356135ad565b346104a35760403660031901126104a357602435610c9a816106a7565b6001600160a01b0380610cab6139e8565b1690821603610cc05761078f90600435612ad8565b60405163334bd91960e11b8152600490fd5b346104a35760403660031901126104a357600435610cef816106a7565b602435610cfa6129a1565b600054818101809111610d475760125410610d185761078f91614393565b60405162461bcd60e51b815260206004820152600760248201526621546f6b656e7360c81b6044820152606490fd5b612bce565b61078f610d5836610abb565b9060405192610d66846103eb565b60008452614261565b346104a35760203660031901126104a357600435610d8c81613edb565b60008281526006602052604090208054916001600160a01b03811691338085149084141715610dba565b1590565b610e6d575b600093610dcb84614094565b610e64575b50610dda826128a5565b80546001600160801b030190554260a01b8217600360e01b17610dfc8561159f565b55600160e11b811615610e31575b5060008051602061519c8339815191528280a461078f610e2c60015460010190565b600155565b60018401610e3e8161159f565b5415610e4b575b50610e0a565b83548114610e4557610e5c9061159f565b553880610e45565b83905538610dd0565b610e8c610db6610e8533610e808761288b565b6128bf565b5460ff1690565b15610dbf57604051632ce44b5f60e11b8152600490fd5b346104a35760203660031901126104a3576020610ec160043561330c565b6040519015158152f35b805190610ee060409283855283850190610a41565b90602080910151938181840391015283519182815281810182808560051b8401019601946000925b858410610f19575050505050505090565b909192939495968580610f51600193601f1986820301885286838d5163ffffffff60e01b815116845201519181858201520190610513565b990194019401929594939190610f08565b602080820190808352835180925260408301928160408460051b8301019501936000915b848310610f965750505050505090565b9091929394958480610fb4600193603f198682030187528a51610ecb565b9801930193019194939290610f86565b346104a3576000806003193601126108b657604051630940198960e31b81529080826004817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa91821561117b578192611157575b5081519161102f615107565b80519280815b86811061112257506110536110589161104e888861328e565b612c06565b614774565b948193825b8281106110c757505050915b83831061107e57604051806106468782610f62565b6110bb6110c1916110a061109b6110958787612d20565b516147c4565b614911565b6110aa8289612d20565b526110b58188612d20565b50613280565b92613280565b91611069565b6110df610db66110d78385612d20565b515151614f68565b6110f2575b6110ed90613280565b61105d565b9461111a6110ed916111048885612d20565b5161110f828c612d20565b526110b5818b612d20565b9590506110e4565b61112f6110d78287612d20565b611142575b61113d90613280565b611035565b9061114f61113d91613280565b919050611134565b6111749192503d8084833e61116c8183610421565b81019061469e565b9038611023565b613c68565b346104a35760203660031901126104a357602060043561119f816106a7565b6040519060018060a01b03807f0000000000000000000000000000000000000000000000000000000000000000169116148152f35b346104a35760603660031901126104a3576004356024356111f4816106a7565b6111fc6106ce565b611204612931565b6127106001600160601b0382168181116112935750506001600160a01b038216156112735761078f9261125e61126e9261124e61123f610442565b6001600160a01b039096168652565b6001600160601b03166020850152565b600052600a602052604060002090565b6139b4565b604051634b4f842960e11b81526004810184905260006024820152604490fd5b60649185916040519263dfd1fc1b60e01b8452600484015260248301526044820152fd5b346104a35760203660031901126104a35760206001600160a01b036112dd600435613edb565b16604051908152f35b346104a35760003660031901126104a3576020600f54604051908152f35b346104a35760203660031901126104a357600435611321816106a7565b6001600160a01b0316801561135157600052600560205260206001600160401b0360406000205416604051908152f35b6040516323d3ad8160e21b8152600490fd5b346104a3576000806003193601126108b65761137d612b48565b601380546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b9181601f840112156104a3578235916001600160401b0383116104a357602083818601950101116104a357565b906003196040818401126104a3576004356001600160401b03918282116104a35760809082860301126104a357600401926024359182116104a357611435916004016113c1565b9091565b346104a357611447366113ee565b91906114616114596060840184612c82565b81019061358e565b926001600160a01b039091169183156115065760005491611482858461328e565b60125410610d1857610646957fff097c7d8b1957a4ff09ef1361b5fb54dcede3941ba836d0beb9d10bec725de6926114b992613b39565b936114c48185614393565b6114db6114cf6139e8565b6001600160a01b031690565b60408051948552602085019290925292a36040516001600160a01b0390911681529081906020820190565b60405162461bcd60e51b815260206004820152600360248201526271747960e81b6044820152606490fd5b346104a35760206001600160a01b03604061154e61054c366104c6565b51015116604051908152f35b346104a35760003660031901126104a3576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6000526004602052604060002090565b7f8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c60005260086020527f85da32aea425a83be1133c4e958580985fa04602ddf03ad35008a70703b20eb790565b346104a35760203660031901126104a3576004356000526011602052602060ff604060002054166040519015158152f35b346104a3576000806003193601126108b6576116d79061166c7f0000000000000000000000000000000000000000000000000000000000000000612ea3565b6116957f0000000000000000000000000000000000000000000000000000000000000000612f9b565b91604051916116a3836103eb565b818352604051948594600f60f81b86526116c960209360e08589015260e0880190610513565b908682036040880152610513565b904660608601523060808601528260a086015284820360c08601528080855193848152019401925b82811061170e57505050500390f35b8351855286955093810193928101926001016116ff565b346104a35760003660031901126104a3576013546040516001600160a01b039091168152602090f35b346104a35760403660031901126104a357602060ff611786602435611772816106a7565b6004356000526008845260406000206128bf565b54166040519015158152f35b346104a3576117a0366104c6565b6117a8612931565b80516001600160401b0381116103cb576117cc816117c76015546119a3565b61333e565b602080601f8311600114611809575081926000926117fe575b5050600019600383901b1c191660019190911b17601555005b0151905038806117e5565b6015600052601f198316939091907f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475926000905b868210611874575050836001951061185b575b505050811b01601555005b015160001960f88460031b161c19169055388080611850565b8060018596829496860151815501950193019061183d565b346104a3576000806003193601126108b657604051816003546118ae816119a3565b8084529060019081811690811561088e57506001146118d7576106468461082981880382610421565b60038352602094507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b82841061191d5750505081610646936108299282010193610819565b8054858501870152928501928101611901565b9060406003198301126104a35760043591602435906001600160401b0382116104a357611435916004016113c1565b346104a35761064661197961197336611930565b916131d6565b604051918291602083526020830190610513565b634e487b7160e01b600052600060045260246000fd5b90600182811c921680156119d3575b60208310146119bd57565b634e487b7160e01b600052602260045260246000fd5b91607f16916119b2565b90600092918054916119ee836119a3565b918282526001938481169081600014611a505750600114611a10575b50505050565b90919394506000526020928360002092846000945b838610611a3c575050505001019038808080611a0a565b805485870183015294019385908201611a25565b9294505050602093945060ff191683830152151560051b01019038808080611a0a565b346104a35760203660031901126104a357600435600052600e602052610646611aa96119796040600020604051928380926119dd565b0382610421565b346104a35760003660031901126104a357602060405160008152f35b346104a35760403660031901126104a357600435611ae9816106a7565b602435908115158092036104a357336000526007602052611b0e8160406000206128bf565b60ff1981541660ff841617905560405191825260018060a01b0316907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b602080820190808352835180925260408301928160408460051b8301019501936000915b848310611b865750505050505090565b9091929394958480611ba4600193603f198682030187528a51610513565b9801930193019194939290611b76565b346104a35760203660031901126104a3576001600160401b036004358181116104a357366023820112156104a35780600401359182116104a3573660248360051b830101116104a357610646916024611c0d9201612d34565b60405191829182611b52565b60803660031901126104a357600435611c31816106a7565b602435611c3d816106a7565b606435916001600160401b0383116104a357611c6061078f9336906004016104a8565b9160443591614261565b346104a357610646611c7e61054c366104c6565b604051918291602083526020830190610ecb565b346104a3576040611cab611ca5366113ee565b91613a41565b825191151582526001600160a01b03166020820152f35b6001600160401b0381116103cb5760051b60200190565b81601f820112156104a357803590611cf082611cc2565b92604092611d0084519586610421565b808552602093848087019260051b850101938385116104a357858101925b858410611d2f575050505050505090565b6001600160401b0384358181116104a35783019184601f1984890301126104a3578451611d5b816103b0565b89840135611d68816105cd565b8152858401359283116104a357611d86888b809695819601016104a8565b83820152815201930192611d1e565b600319906020818301126104a3576004908135916001600160401b038084116104a35760408585850301126104a35760405194611dd1866103b0565b848301358281116104a35760609086019182860301126104a35760405190611df8826103d0565b838101358381116104a3578585611e11928401016104a8565b82526024810135908382116104a357611e3086866044948401016104a8565b60208401520135611e40816106a7565b6040820152855260248401359081116104a357611e5e930101611cd9565b602082015290565b346104a357611e7436611d95565b611e84611e7f6144dc565b614485565b805151611e9b611e9382614809565b541515614d42565b611eb76002611ea9836147c4565b01546001600160a01b031690565b82516040908101516001600160a01b0393919284169190611edc908516831415614da0565b611eef8551611eea836147c4565b614b72565b6003611f0481611efe846147c4565b01614889565b805190611f1a83611f14866147c4565b01614e47565b60005b82811061207357505050602094858701918251519760005b898110611f3e57005b80855190611f4b91612d20565b51611f5590614c15565b8982875190611f6391612d20565b5101518951808c81019283611f7791612cd0565b03601f1981018252611f899082610421565b5190206001600160e01b031991611fa591831690831614614c23565b825182875190611fb491612d20565b51611fbe90614c15565b611fc790614a09565b90611fd191614b72565b83611fdb886147c4565b0182875190611fe991612d20565b51611ff391614cf6565b82518901516001600160a01b031690888388519061201091612d20565b5161201a90614c15565b918c858a519061202991612d20565b51015192888d519283921695169361204190826107cc565b037f7f4649aa14a7e9abd7f21a02ea35b32c907d59bb701c52c0e028ddf57533c74c91a461206e90613280565b611f35565b8061209a61209561209061208a61209f9587612d20565b51614c15565b614a09565b614e9d565b613280565b611f1d565b346104a35760203660031901126104a357610646611979600435613733565b346104a35760203660031901126104a35760206004356120e2816105cd565b6001600160a01b03906040906120f790614a41565b015116604051908152f35b346104a35761211036611930565b916121196129a1565b61212281613097565b61212d8484836131d6565b9261214760405161213d816103eb565b60008152836133bd565b61215184836135ad565b6121596139e8565b906000194301438111610d47576121b66094610646986121ca95604051948286936020850198893783019144602084015260018060601b03199060601b166040830152426054830152406074820152036074810184520182610421565b519020916000526014602052604060002090565b557f6df1d8db2a036436ffe0b2d1833f2c5f1e624818dfce2578c0faa4b83ef9998d604051806121fa85826107cc565b0390a2604051918291826107cc565b346104a35760603660031901126104a3576001600160401b036004356024358281116104a35761223d9036906004016113c1565b90916044358481116104a3576122579036906004016113c1565b9390946122626129a1565b8461236e575b508115612341576012549261227e36828461046c565b9280850195868611610d4757600f5497600160401b8910156103cb5761232161231c61232e9461230d7f2a0365091ef1a40953c670dce28177e37520648a6fdc91506bffac0ab045570d996122fa8d6106469f8060016122e19201600f55613055565b90919082549060031b91821b91600019901b1916179055565b8c600052601060205260406000206134e6565b6123168b601255565b8961328e565b612bf7565b93604051958695866134ba565b0390a26040519081529081906020820190565b60405162461bcd60e51b81526020600482015260056024820152640c08185b5d60da1b6044820152606490fd5b8486016040878203126104a35786359182116104a35761238f9187016104a8565b511515806123ca575b6123a3575b38612268565b601254828101809111610d47576123c5906123bf36878961046c565b906133bd565b61239d565b5060208501351515612398565b346104a35760403660031901126104a35761078f6024356004356123fa826106a7565b806000526008602052612414600160406000200154612a33565b612ad8565b346104a35761242736611d95565b612432611e7f6144dc565b80515161244661244182614ede565b614b14565b6124548251611eea836147c4565b81516040908101516001600160a01b0392906124739084161515614ba8565b602092838501908151519560005b87811061248a57005b80846125086124f66124e98a6124cb6124d98e806124ba8a6124b361208a6125cb9e8d51612d20565b9a51612d20565b510151935192839182018095612cd0565b03601f198101835282610421565b5190206001600160e01b03191690565b6001600160e01b03191690565b6001600160e01b031992831614614c23565b61252a6125246114cf6002611ea961209061208a888d51612d20565b15614c8b565b6125408451611eea61209061208a868b51612d20565b612561600361254e896147c4565b0161255a848951612d20565b5190614cf6565b83518801516001600160a01b0316907fb5a3e9571e367979a4a14de42b248d0837c26fd8e879846062abcf7cee17127361259f61208a858a51612d20565b918b6125ac868b51612d20565b510151926125c3898d5193849316961694826107cc565b0390a3613280565b612481565b346104a35760403660031901126104a3576001600160401b036004358181116104a3576126019036906004016104a8565b906024359081116104a357610646916126216119799236906004016113c1565b9161329b565b346104a3576000806003193601126108b65760405181601554612649816119a3565b8084529060019081811690811561088e5750600114612672576106468461082981880382610421565b60158352602094507f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec4755b8284106126b85750505081610646936108299282010193610819565b805485850187015292850192810161269c565b346104a35760403660031901126104a357602060ff6117866004356126ef816106a7565b602435906126fc826106a7565b6001600160a01b0316600090815260078552604090206128bf565b346104a357612725366104c6565b612730611e7f6144dc565b61274161273c8261503a565b614d42565b61274f6002611ea9836147c4565b61276e6127696127636003611efe866147c4565b936147c4565b614ebb565b8151906001600160a01b031660005b82811061278657005b8061279761208a6127fa9387612d20565b837f5968261591c9d57680edfe0bed3bb6a37ab7fb354578affd1e5be8ce18e6c9d36127e460206127c8868b612d20565b5101516040516001600160e01b031990951694918291826107cc565b0390a361209a61209561209061208a8489612d20565b61277d565b346104a35760203660031901126104a35760043561281c816106a7565b612824612b48565b6001600160a01b0390811690811561287257601380546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b604051631e4fbdf760e01b815260006004820152602490fd5b6001600160a01b0316600090815260076020526040902090565b6001600160a01b0316600090815260056020526040902090565b9060018060a01b0316600052602052604060002090565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6600052600860205260ff9061292c907f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb6128bf565b541690565b6129396139e8565b60008052600860205260ff61296e827f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c76128bf565b5416156129785750565b60405163e2517d3f60e01b81526001600160a01b03909116600482015260006024820152604490fd5b6129a96139e8565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66000819052600860205260ff612a00837f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb6128bf565b541615612a0b575050565b60405163e2517d3f60e01b81526001600160a01b039092166004830152602482015260449150fd5b612a3b6139e8565b9080600052600860205260ff612a008360406000206128bf565b600090808252600860205260ff612a6f84604085206128bf565b5416612ad2578082526008602052612a8a83604084206128bf565b805460ff191660011790557f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d6001600160a01b0380612ac76139e8565b1694169280a4600190565b50905090565b600090808252600860205260ff612af284604085206128bf565b541615612ad2578082526008602052612b0e83604084206128bf565b805460ff191690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b6001600160a01b0380612ac76139e8565b6013546001600160a01b0390811681612b5f6139e8565b1603612b685750565b602490612b736139e8565b60405163118cdaa760e01b815291166004820152fd5b80546001600160a01b0319166001600160a01b03909216919091179055565b60405190612bb5826103b0565b6009546001600160a01b038116835260a01c6020830152565b634e487b7160e01b600052601160045260246000fd5b81810292918115918404141715610d4757565b600019810191908211610d4757565b91908203918211610d4757565b90612c1d82611cc2565b612c2a6040519182610421565b8281528092612c3b601f1991611cc2565b019060005b828110612c4c57505050565b806060602080938501015201612c40565b6000198114610d475760010190565b634e487b7160e01b600052603260045260246000fd5b903590601e19813603018212156104a357018035906001600160401b0382116104a3576020019181360383136104a357565b90821015612ccb576114359160051b810190612c82565b612c6c565b90612ce3602092828151948592016104f0565b0190565b6020908161044f939594612d148760405198899585870137840191838301600081528151948592016104f0565b01038085520183610421565b8051821015612ccb5760209160051b010190565b6001600160a01b03612d446139e8565b1633149160008093600014612dc45750604051612d60816103eb565b83815283368137905b612d7281612c13565b935b818110612d82575050505090565b80612da4612d9e85612d98612dbf95878a612cb4565b90612ce7565b30612e27565b612dae8288612d20565b52612db98187612d20565b50612c5d565b612d74565b36601319810194508411610d475760405190612ddf826103b0565b60148252601481956020840137603482015290612d69565b3d15612e22573d90612e0882610451565b91612e166040519384610421565b82523d6000602084013e565b606090565b6000806104c393602081519101845af4612e3f612df7565b9190612e675750805115612e5557805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580612e9a575b612e78575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b15612e70565b60ff8114612ee15760ff811690601f8211612ecf5760405191612ec5836103b0565b8252602082015290565b604051632cd44ac360e21b8152600490fd5b50604051600b54816000612ef4836119a3565b808352600193808516908115612f7a5750600114612f1a575b506104c392500382610421565b600b60009081527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db994602093509091905b818310612f625750506104c3935082010138612f0d565b85548784018501529485019486945091830191612f4b565b90506104c394506020925060ff191682840152151560051b82010138612f0d565b60ff8114612fbd5760ff811690601f8211612ecf5760405191612ec5836103b0565b50604051600c54816000612fd0836119a3565b808352600193808516908115612f7a5750600114612ff557506104c392500382610421565b600c60009081527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c794602093509091905b81831061303d5750506104c3935082010138612f0d565b85548784018501529485019486945091830191613026565b600f54811015612ccb57600f60005260206000200190600090565b60008051602061517c8339815191528054821015612ccb5760005260206000200190600090565b600f548110156130cc57600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802015490565b60405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606490fd5b9092919261310e81610451565b9161311c6040519384610421565b8294828452828201116104a357602061044f9301906104f0565b91906040838203126104a35782516001600160401b0381116104a357830181601f820112156104a357602091818361317093519101613101565b92015190565b92602080959461318e839594828151948592016104f0565b01918237019081520190565b156131a157565b60405162461bcd60e51b815260206004820152600d60248201526c496e636f7272656374206b657960981b6044820152606490fd5b92919092600052600e602052611aa96131f96040600020604051928380926119dd565b80511561324757816124cb61323e61322961044f95613222866020808c99518301019101613136565b969061329b565b96604051928391602083019546918b88613176565b5190201461319a565b60405162461bcd60e51b8152602060048201526011602482015270139bdd1a1a5b99c81d1bc81c995d99585b607a1b6044820152606490fd5b9060018201809211610d4757565b91908201809211610d4757565b909291928151916040918251956020938486890101815285885260005b8681106132c85750505050505050565b815186810190848683376132ec8482878101868c820152038a810184520182610421565b5190208682870101511886828b010152858101809111156132b857612bce565b600052600e6020526133226040600020546119a3565b151590565b818110613332575050565b60008155600101613327565b90601f821161334b575050565b61044f9160156000526020600020906020601f840160051c83019310613379575b601f0160051c0190613327565b909150819061336c565b9190601f811161339257505050565b61044f926000526020600020906020601f840160051c8301931061337957601f0160051c0190613327565b9190916000526020600e81526040600020908351906001600160401b0382116103cb576133f4826133ee85546119a3565b85613383565b80601f831160011461342e575081929394600092613423575b50508160011b916000199060031b1c1916179055565b01519050388061340d565b90601f1983169561344485600052602060002090565b926000905b88821061348157505083600195969710613468575b505050811b019055565b015160001960f88460031b161c1916905538808061345e565b80600185968294968601518155019501930190613449565b908060209392818452848401376000828201840152601f01601f1916010190565b93916104c395936134d8928652606060208701526060860191613499565b926040818503910152613499565b91909182516001600160401b0381116103cb5761350d8161350784546119a3565b84613383565b602080601f831160011461353d5750819293946000926134235750508160011b916000199060031b1c1916179055565b90601f1983169561355385600052602060002090565b926000905b8882106135765750508360019596971061346857505050811b019055565b80600185968294968601518155019501930190613558565b91908260409103126104a357602082356135a7816106a7565b92013590565b80600052601160205260ff60406000205416613616576135fb7f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c9282600052601060205260406000206134e6565b6136048161369a565b604080519182526020820192909252a1565b60405162461bcd60e51b815260206004820152600c60248201526b2130ba31b410333937bd32b760a11b6044820152606490fd5b60405190600f548083528260209182820190600f60005283600020936000905b8282106136805750505061044f92500383610421565b85548452600195860195889550938101939091019061366a565b600f54906136a661364a565b600091825b8481106136e95760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a590818985d18da1259608a1b6044820152606490fd5b6136f38184612d20565b5182146137085761370390612c5d565b6136ab565b91929350508061371757505090565b9091506000198101908111610d475761372f91612d20565b5190565b61373c8161381e565b9061374683613883565b926137508261330c565b1561377f575050506104c3613772916124cb6040519384926020840190612cd0565b600360fc1b815260010190565b9061378a9291613904565b6040519060a08201604052608082019060008252905b6000190190600a9060308282060183530490816137a05790506137e2926137e86104c3936080601f199485810192030181526040519586936020850190612cd0565b90612cd0565b03908101835282610421565b60609060208152600f60208201526e125b9d985b1a59081d1bdad95b9259608a1b60408201520190565b90600f549161382b61364a565b9060005b84811061384f5760405162461bcd60e51b8152806107aa600482016137f4565b6138598184612d20565b51821061387157600181018091111561382f57612bce565b9350508261387e91612d20565b519190565b90600f549161389061364a565b600091825b8581106138b55760405162461bcd60e51b8152806107aa600482016137f4565b6138bf8184612d20565b5182106138d757600181018091111561389557612bce565b611aa99495506138ec91506104c39392612d20565b518152601060205260408091209051928380926119dd565b919080600052601460205260406000205480156139825760009280613963575b5082820391808311610d4757831461394d578190068301809311610d47576104c392069061328e565b634e487b7160e01b600052601260045260246000fd5b9092506000198101908111610d475761397b90613097565b9138613924565b50505090565b63ffffffff60e01b16637965db0b60e01b81149081156139a6575090565b6301ffc9a760e01b14919050565b90602060018060a01b03916139cc8382511685612b89565b0151825490911660a09190911b6001600160a01b031916179055565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161480613a36575b15613a32576013193601368111610d47573560601c90565b3390565b506014361015613a1a565b91610e85613aff610db692613af9613b1095613af1613a5f89613b25565b613a6b60208b01613b25565b90613a89613a8260408d01359c6060810190612c82565b369161046c565b602081519101206040519160208301937f242b17107e6aef17754836dd680cb66bbf39e46a5f20952950acbbae68643d02855260018060801b0380921660408501521660608301528b608083015260a082015260a08152613ae981610406565b519020613d9b565b92369161046c565b90613c16565b93600052600d602052604060002090565b80613b185791565b50613b22816128d6565b91565b356001600160801b03811681036104a35790565b9291613b459184613a41565b929015613be757613b5581613b25565b426001600160801b03909116118015613bc4575b613b9557613b88604061044f920135600052600d602052604060002090565b805460ff19166001179055565b60405162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b6044820152606490fd5b50613be0613bd460208301613b25565b6001600160801b031690565b4211613b69565b60405162461bcd60e51b8152602060048201526007602482015266125b9d985b1a5960ca1b6044820152606490fd5b6104c391613c2391613c2c565b90929192613d0e565b8151919060418303613c5d57613c5692506020820151906060604084015193015160001a90613c74565b9192909190565b505060009160029190565b6040513d6000823e3d90fd5b91906fa2a8918ca85bafe22016d0b997e4df60600160ff1b038411613ce257926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa1561117b5780516001600160a01b03811615613cd957918190565b50809160019190565b50505060009160039190565b60041115613cf857565b634e487b7160e01b600052602160045260246000fd5b613d1781613cee565b80613d20575050565b613d2981613cee565b60018103613d435760405163f645eedf60e01b8152600490fd5b613d4c81613cee565b60028103613d6d5760405163fce698f760e01b815260048101839052602490fd5b80613d79600392613cee565b14613d815750565b6040516335e2f38360e21b81526004810191909152602490fd5b604290613da6613dc1565b906040519161190160f01b8352600283015260228201522090565b307f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161480613eb2575b15613e1c577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a08152613eac81610406565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000004614613df3565b8060009081548110613efa575b604051636f96cda160e11b8152600490fd5b81526004906020918083526040928383205494600160e01b861615613f2157505050613ee8565b93929190935b8515613f3557505050505090565b60001901808352818552838320549550613f27565b90613f5483613edb565b6001600160a01b038381169282821684900361408357600086815260066020526040902080549092613f956001600160a01b03881633908114908414171590565b614059575b821695861561404757613fcd93613fc092613fb585846141cf565b61403d575b506128a5565b80546000190190556128a5565b80546001019055600160e11b4260a01b84178117613fea8661159f565b55811615614009575b5060008051602061519c833981519152600080a4565b600184016140168161159f565b5415614023575b50613ff3565b600054811461401d576140359061159f565b55388061401d565b6000905538613fba565b604051633a954ecd60e21b8152600490fd5b61406c610db6610e8533610e808b61288b565b15613f9a57604051632ce44b5f60e11b8152600490fd5b60405162a1148160e81b8152600490fd5b61409c6115af565b9060009182805260205260ff6040832054161580614139575b80614132575b6140c3575050565b6140d160ff91610e806115af565b5416159081614113575b506140e257565b60405162461bcd60e51b815260206004820152600960248201526810aa2920a729a322a960b91b6044820152606490fd5b60ff91506040906141226115af565b81805260205220541615386140db565b50816140bb565b506001600160a01b03811615156140b5565b6141536115af565b60009081805260205260ff60408220541615806141c8575b806141b6575b614179575050565b604060ff916141866115af565b81805260205220541615908161419d57506140e257565b60ff91506141ad90610e806115af565b541615386140db565b506001600160a01b0382161515614171565b508061416b565b6141d76115af565b600080526020526141f060ff6040600020541615151590565b8061424f575b8061423d575b614204575050565b610db6610e8561421692610e806115af565b908161422357506140e257565b6142379150610e85610db691610e806115af565b386140db565b506001600160a01b03821615156141fc565b506001600160a01b03811615156141f6565b92919061426f828286613f4a565b803b61427b5750505050565b614284936142ea565b156142925738808080611a0a565b6040516368d2bf6b60e11b8152600490fd5b908160209103126104a357516104c3816105cd565b6001600160a01b0391821681529116602082015260408101919091526080606082018190526104c392910190610513565b92602091614313936000604051809681958294630a85bd0160e11b9a8b855233600486016142b9565b03926001600160a01b03165af160009181614363575b5061435557614336612df7565b80519081614350576040516368d2bf6b60e11b8152600490fd5b602001fd5b6001600160e01b0319161490565b61438591925060203d811161438c575b61437d8183610421565b8101906142a4565b9038614329565b503d614373565b906000908154928115614434576143a98161414b565b6143b2816128a5565b80546001600160401b0184020190556001600160a01b0316906001904260a01b81831460e11b1783176143e48661159f565b558401938160008051602061519c83398151915291808587858180a4015b85810361442557505050156144145755565b604051622e076360e81b8152600490fd5b8083918587858180a401614402565b60405163b562e8dd60e01b8152600490fd5b600080806001600160a01b03604061446883356001600160e01b031916614a41565b015116368280378136915af43d82803e15614481573d90f35b3d90fd5b1561448c57565b60405162461bcd60e51b815260206004820152602260248201527f42617365526f757465723a2063616c6c6572206e6f7420617574686f72697a65604482015261321760f11b6064820152608490fd5b60ff61292c6144e96139e8565b6000805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c76128bf565b9080601f830112156104a35781516104c392602001613101565b9190916060818403126104a3576040519061454c826103d0565b81938151916001600160401b03928381116104a3578261456d918301614518565b845260208101519283116104a35761458b6040939284938301614518565b602085015201519161459c836106a7565b0152565b919060409283818303126104a35783516145b9816103b0565b80948251936001600160401b03948581116104a357816145da918601614532565b835260209384810151908682116104a357019181601f840112156104a35782519061460482611cc2565b9661461182519889610421565b828852868089019360051b860101948486116104a357878101935b86851061463e57505050505050500152565b84518381116104a35782019084601f1983890301126104a357845190614663826103b0565b8a830151614670816105cd565b825285830151918583116104a35761468f898d80969581960101614518565b8382015281520194019361462c565b9060209081838203126104a35782516001600160401b03938482116104a3570181601f820112156104a35780516146d481611cc2565b946146e26040519687610421565b818652848087019260051b840101938085116104a357858401925b85841061470e575050505050505090565b83518381116104a3578791614728848480948a01016145a0565b8152019301926146fd565b60405190614740826103d0565b600060408360608152606060208201520152565b60405190614761826103b0565b606060208361476e614733565b81520152565b9061477e82611cc2565b61478b6040519182610421565b828152809261479c601f1991611cc2565b019060005b8281106147ad57505050565b6020906147b8614754565b828285010152016147a1565b60206147dd9181604051938285809451938492016104f0565b81017f1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee0087581520301902090565b60206148229181604051938285809451938492016104f0565b81016000805160206151bc83398151915281520301902090565b90604051614849816103d0565b60408193815161485d81611aa981856119dd565b8352815161487281611aa981600186016119dd565b6020840152600201546001600160a01b0316910152565b90815461489581611cc2565b926040936148a585519182610421565b828152809460208092019260005281600020906000935b8585106148cb57505050505050565b60028460019284516148dc816103b0565b865460e01b6001600160e01b031916815285516148ff81611aa981898c016119dd565b838201528152019301940193916148bc565b9060405161491e816103b0565b6020614938600383956149308161483c565b855201614889565b910152565b614945614754565b5061494f81614809565b5460009015614965575061109b6104c3916147c4565b80614984926040518094819263611383f760e11b8352600483016107cc565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa91821561117b5781926149c457505090565b909291503d8084833e6149d78183610421565b810190602081830312614a05578051906001600160401b038211614a01576104c3939450016145a0565b8480fd5b8380fd5b63ffffffff60e01b166000527f1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee00876602052604060002090565b614a49614733565b50614a5b614a5682614a09565b61483c565b604081015190916001600160a01b039160009190831615614a7c5750505090565b81929350602460405180958193631097b48960e11b835263ffffffff60e01b1660048301527f0000000000000000000000000000000000000000000000000000000000000000165afa91821561117b578192614ad757505090565b909291503d8084833e614aea8183610421565b810190602081830312614a05578051906001600160401b038211614a01576104c393945001614532565b15614b1b57565b60405162461bcd60e51b815260206004820152602960248201527f457874656e73696f6e53746174653a20657874656e73696f6e20616c726561646044820152683c9032bc34b9ba399760b91b6064820152608490fd5b600261044f92614b838151846134e6565b614b946020820151600185016134e6565b604001516001600160a01b03169101612b89565b15614baf57565b60405162461bcd60e51b815260206004820152603860248201527f457874656e73696f6e53746174653a20616464696e6720657874656e73696f6e604482015277103bb4ba3437baba1034b6b83632b6b2b73a30ba34b7b71760411b6064820152608490fd5b516001600160e01b03191690565b15614c2a57565b60405162461bcd60e51b815260206004820152603360248201527f457874656e73696f6e53746174653a20666e2073656c6563746f7220616e642060448201527239b4b3b730ba3ab9329036b4b9b6b0ba31b41760691b6064820152608490fd5b15614c9257565b60405162461bcd60e51b815260206004820152603660248201527f457874656e73696f6e53746174653a20657874656e73696f6e20616c726561646044820152753c9032bc34b9ba39903337b910333ab731ba34b7b71760511b6064820152608490fd5b908154600160401b8110156103cb5760018101808455811015612ccb57602060019161044f946000528160002090831b0192805160e01c63ffffffff19855416178455015191016134e6565b15614d4957565b60405162461bcd60e51b815260206004820152602960248201527f457874656e73696f6e53746174653a20657874656e73696f6e20646f6573206e60448201526837ba1032bc34b9ba1760b91b6064820152608490fd5b15614da757565b60405162461bcd60e51b815260206004820152602960248201527f457874656e73696f6e53746174653a2072652d616464696e672073616d6520656044820152683c3a32b739b4b7b71760b91b6064820152608490fd5b614e0881546119a3565b9081614e12575050565b81601f60009311600114614e24575055565b908083918252614e43601f60208420940160051c840160018501613327565b5555565b805460009182815581614e5957505050565b6001600160ff1b0382168203610d475782526020822091600191821b8301925b838110614e865750505050565b808260029255614e97848201614dfe565b01614e79565b6002600091614eab81614dfe565b614eb760018201614dfe565b0155565b600361044f91611f1481614e9d565b9190614ed95761044f916134e6565b61198d565b614ee781614809565b54614f625760008051602061517c8339815191528054600160401b8110156103cb5760018101808355811015612ccb5781614f3084602093614f459560005284600020016134e6565b549281604051938285809451938492016104f0565b81016000805160206151bc83398151915281520301902055600190565b50600090565b6020614f819181604051938285809451938492016104f0565b81016000805160206151bc83398151915281520301902054151590565b60008051602061517c83398151915280548015615024576000190190614fc382613070565b614ed957614fd181546119a3565b9081614fdc57505055565b601f8211600114614fef57600091505555565b61501161502192826000526001601f6020600020920160051c82019101613327565b6000908082528160208120915555565b55565b634e487b7160e01b600052603160045260246000fd5b604051602081835161504f81838588016104f0565b6000805160206151bc83398151915290820190815203019020548015615100576000199181830191808311610d475760008051602061517c83398151915254938401938411610d475783836150b794600096036150bd575b5050506150b2614f9e565b614809565b55600190565b6150b26150e5916150f16150d36150f795613070565b50916150ec60405180968180966119dd565b0384610421565b613070565b90614eca565b553880806150a7565b5050600090565b60008051602061517c83398151915290815461512281611cc2565b9260409361513285519182610421565b828152809460208092019260005281600020906000935b85851061515857505050505050565b6001848192845161516d81611aa9818a6119dd565b81520193019401939161514956fe1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee00873ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee00874a164736f6c6343000814000a6080806040523461002857600080546001600160a01b031916331790556111ee908161002e8239f35b600080fdfe6080604052600436101561001257600080fd5b60003560e01c8063012b872914610a49578063212f6912146109715780634a00cc481461074f5780637c3b113714610700578063c22707ee146106ad5763fdc9f2571461005e57600080fd5b346106a8576003196020368201126106a8576001600160401b036004358181116106a85760408382360301126106a8576040519261009b84610af9565b81600401358381116106a85760609083019182360301126106a857604051906100c382610b14565b60048101358481116106a8576100df9060043691840101610b50565b82526024810135908482116106a85761010060449260043691840101610b50565b602084015201356001600160a01b03811681036106a857604082015283526024810135908282116106a8570190366023830112156106a85760048201359161014783610cc3565b926101556040519485610b2f565b8084526024602085019160051b830101913683116106a85760248101915b83831061063a576020870186905260005487906001600160a01b031633036105e357805151906101a2826110f1565b1561058c57805160026101b484610d2f565b6101bf835182610fe2565b6101d0602084015160018301610fe2565b604092830151910180546001600160a01b0319166001600160a01b039283161790558251909101511615610526576020810151519160005b83811061021157005b63ffffffff60e01b610227826020860151610d1b565b51511660206102398382870151610d1b565b510151604051906102676020838161025a8183019586815193849201610ba6565b8101038085520183610b2f565b905190206001600160e01b031916036104c55763ffffffff60e01b610290826020860151610d1b565b51511660009081526000805160206111c283398151915260205260409020600201546001600160a01b031661046157825163ffffffff60e01b6102d7836020870151610d1b565b5151166000526000805160206111c283398151915260205260026040600020610301835182610fe2565b610312602084015160018301610fe2565b604090920151910180546001600160a01b0319166001600160a01b0392909216919091179055600361034383610d2f565b01610352826020860151610d1b565b518154600160401b81101561044b576001810180845581101561043557602060019161039e946000528160002090831b0192805160e01c63ffffffff1985541617845501519101610fe2565b60018060a01b036040845101511663ffffffff60e01b6103c2836020870151610d1b565b515116907fb5a3e9571e367979a4a14de42b248d0837c26fd8e879846062abcf7cee17127361041060206103f986828a0151610d1b565b510151604051918291602083526020830190610bc9565b0390a3600181018091111561020857634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60405162461bcd60e51b815260206004820152603660248201527f457874656e73696f6e53746174653a20657874656e73696f6e20616c726561646044820152753c9032bc34b9ba39903337b910333ab731ba34b7b71760511b6064820152608490fd5b60405162461bcd60e51b815260206004820152603360248201527f457874656e73696f6e53746174653a20666e2073656c6563746f7220616e642060448201527239b4b3b730ba3ab9329036b4b9b6b0ba31b41760691b6064820152608490fd5b60405162461bcd60e51b815260206004820152603860248201527f457874656e73696f6e53746174653a20616464696e6720657874656e73696f6e604482015277103bb4ba3437baba1034b6b83632b6b2b73a30ba34b7b71760411b6064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f457874656e73696f6e53746174653a20657874656e73696f6e20616c726561646044820152683c9032bc34b9ba399760b91b6064820152608490fd5b60405162461bcd60e51b815260206004820152602960248201527f44656661756c74457874656e73696f6e5365743a20756e617574686f72697a65604482015268321031b0b63632b91760b91b6064820152608490fd5b82358581116106a8578201604060231982360301126106a8576040519161066083610af9565b60248201356001600160e01b0319811681036106a85783526044820135928784116106a857610699602094936024869536920101610b50565b83820152815201920191610173565b600080fd5b346106a85760203660031901126106a8576004356001600160401b0381116106a8576106e86106e36106fc923690600401610b50565b610e93565b604051918291602083526020830190610c2c565b0390f35b346106a85760203660031901126106a8576004356001600160401b0381116106a8576020906001600160a01b0390604090610743906106e3903690600401610b50565b51015116604051908152f35b346106a85760003660031901126106a8577f1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee00873805461078c81610cc3565b9061079a6040519283610b2f565b8082526020928383019060005283600020846000925b84841061095357508480516107c481610cc3565b916107d26040519384610b2f565b818352601f196107e183610cc3565b018460005b82811061093d5750505060005b82811061085c575050506040519082820192808352815180945260408301938160408260051b8601019301916000955b8287106108305785850386f35b90919293828061084c600193603f198a82030186528851610c2c565b9601920196019592919092610823565b61086f6108698284610d1b565b51610d2f565b60036040519161087e83610af9565b61088781610e54565b835201805461089581610cc3565b916108a36040519384610b2f565b818352600090815288812090898085015b8483106108fb5750925050508201526108cd8286610d1b565b526108d88185610d1b565b5060018101809111156107f357634e487b7160e01b600052601160045260246000fd5b60019160029160405161090d81610af9565b865460e01b6001600160e01b0319168152610929858801610dae565b838201528152019301910190918a906108b4565b610945610cfb565b8282880101520185906107e6565b600191829161096185610dae565b81520192019201919085906107b0565b346106a85760203660031901126106a85760043563ffffffff60e01b81168091036106a85761099e610cda565b506000526000805160206111c28339815191526020526109c16040600020610e54565b60408101516001600160a01b0316156109ec576106fc90604051918291602083526020830190610bee565b60405162461bcd60e51b815260206004820152602f60248201527f44656661756c74457874656e73696f6e5365743a206e6f20657874656e73696f60448201526e37103337b910333ab731ba34b7b71760891b6064820152608490fd5b346106a8576020806003193601126106a8576004356001600160401b0381116106a857610a7e6106e383923690600401610b50565b01516040519082820192808352815180945260408301938160408260051b8601019301916000955b828710610ab35785850386f35b909192938280610ae9600193603f198a82030186526040838a5163ffffffff60e01b815116845201519181858201520190610bc9565b9601920196019592919092610aa6565b604081019081106001600160401b0382111761044b57604052565b606081019081106001600160401b0382111761044b57604052565b90601f801991011681019081106001600160401b0382111761044b57604052565b81601f820112156106a8578035906001600160401b03821161044b5760405192610b84601f8401601f191660200185610b2f565b828452602083830101116106a857816000926020809301838601378301015290565b60005b838110610bb95750506000910152565b8181015183820152602001610ba9565b90602091610be281518092818552858086019101610ba6565b601f01601f1916010190565b906040610c19610c078451606085526060850190610bc9565b60208501518482036020860152610bc9565b928101516001600160a01b031691015290565b805190610c4160409283855283850190610bee565b90602080910151938181840391015283519182815281810182808560051b8401019601946000925b858410610c7a575050505050505090565b909192939495968580610cb2600193601f1986820301885286838d5163ffffffff60e01b815116845201519181858201520190610bc9565b990194019401929594939190610c69565b6001600160401b03811161044b5760051b60200190565b60405190610ce782610b14565b600060408360608152606060208201520152565b60405190610d0882610af9565b6060602083610d15610cda565b81520152565b80518210156104355760209160051b010190565b6020610d48918160405193828580945193849201610ba6565b81017f1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee0087581520301902090565b90600182811c92168015610da4575b6020831014610d8e57565b634e487b7160e01b600052602260045260246000fd5b91607f1691610d83565b9060405191826000825492610dc284610d74565b908184526001948581169081600014610e315750600114610dee575b5050610dec92500383610b2f565b565b9093915060005260209081600020936000915b818310610e19575050610dec93508201013880610dde565b85548884018501529485019487945091830191610e01565b915050610dec94506020925060ff191682840152151560051b8201013880610dde565b90604051610e6181610b14565b60408193610e6e81610dae565b8352610e7c60018201610dae565b6020840152600201546001600160a01b0316910152565b610e9b610cfb565b50604080519182815160209481610eb6879383858801610ba6565b81017f1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee008748152030190205415610f8757610eee90610d2f565b916003825193610efd85610af9565b610f0681610e54565b855201805490610f1582610cc3565b93610f2281519586610b2f565b828552600091825283822090848087015b858510610f465750505050505082015290565b6001916002918451610f5781610af9565b865460e01b6001600160e01b0319168152610f73858801610dae565b838201528152019301930192918590610f33565b815162461bcd60e51b815260048101849052602e60248201527f44656661756c74457874656e73696f6e5365743a20657874656e73696f6e206460448201526d37b2b9903737ba1032bc34b9ba1760911b6064820152608490fd5b91909182516001600160401b03811161044b57610fff8254610d74565b601f81116110a9575b50602080601f831160011461104557508192939460009261103a575b50508160011b916000199060031b1c1916179055565b015190503880611024565b90601f198316958460005282600020926000905b88821061109157505083600195969710611078575b505050811b019055565b015160001960f88460031b161c1916905538808061106e565b80600185968294968601518155019501930190611059565b600083815260208120601f840160051c810192602085106110e7575b601f0160051c01915b8281106110dc575050611008565b8181556001016110ce565b90925082906110c5565b6040518151906020830191611107818385610ba6565b8101906020817f1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee00874938481520301902054156000146111b9577f1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee0087391825491600160401b83101561044b57600183018085558310156104355783611197866020956111aa976000528660002001610fe2565b5494604051948593849251928391610ba6565b82019081520301902055600190565b50505060009056fe1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee00876a164736f6c6343000814000a2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec4759f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6000000000000000000000000d8d7cc55608e0a72d18737852b89b8388d04870f00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000015a6bea0a36873d2bc9a47836fb111e18e46241f00000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000000000000000200000000000000000000000000c82bbe41f2cf04e3a8efa18f7032bdd7f6d98a8100000000000000000000000000000000000000000000000000000000000000195065746f706961204865726f657320436f6c6c656374696f6e000000000000000000000000000000000000000000000000000000000000000000000000000008504554204845524f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569686377626d6b6a68696d6679657176716b36697176766f3532783271326f716e6f37786264766d3569336665637869327372646d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040526004361015610015575b3661444657005b60003560e01c8063012b87291461039557806301ffc9a71461039057806304634d8d1461038b57806306fdde0314610386578063081812fc14610381578063095ea7b31461037c57806318160ddd146103775780631ee8b41b14610372578063212f69121461036d57806323b872dd146103685780632419f51b14610363578063248a9ca31461035e5780632a55205a146103595780632f2ff15d1461035457806333cfcb9f1461034f57806336568abe1461034a57806340c10f191461034557806342842e0e1461034057806342966c681461033b578063492e224b146103365780634a00cc4814610331578063572b6c051461032c5780635944c753146103275780636352211e1461032257806363b45e2d1461031d57806370a0823114610318578063715018a6146103135780637a70a8951461030e5780637c3b1137146103095780637da0a8771461030457806383040532146102ff57806384b0196e146102fa5780638da5cb5b146102f557806391d14854146102f0578063938e3d7b146102eb57806395d89b41146102e65780639fc4d68f146102e1578063a05112fc146102dc578063a217fddf146102d7578063a22cb465146102d2578063ac9650d8146102cd578063b88d4fde146102c8578063c22707ee146102c3578063c4376dd7146102be578063c54c07e1146102b9578063c87b56dd146102b4578063ce0b6013146102af578063ce805642146102aa578063d37c353b146102a5578063d547741f146102a0578063e05688fe1461029b578063e715032214610296578063e8a3d48514610291578063e985e9c51461028c578063ee7d2adf146102875763f2fde38b0361000e576127ff565b612717565b6126cb565b612627565b6125d0565b612419565b6123d7565b612209565b612102565b6120c3565b6120a4565b611e66565b611c92565b611c6a565b611c19565b611bb4565b611acc565b611ab0565b611a73565b61195f565b61188c565b611792565b61174e565b611725565b61162d565b6115fc565b61155a565b611531565b611439565b611363565b611304565b6112e6565b6112b7565b6111d4565b611180565b610fc4565b610ea3565b610d6f565b610d4c565b610cd2565b610c7d565b610c3a565b610bf8565b610b4e565b610b1f565b610af9565b610ae7565b610a7f565b6109fc565b6109d9565b610930565b6108b9565b6107dd565b6106e4565b6105df565b610538565b634e487b7160e01b600052604160045260246000fd5b604081019081106001600160401b038211176103cb57604052565b61039a565b606081019081106001600160401b038211176103cb57604052565b602081019081106001600160401b038211176103cb57604052565b60c081019081106001600160401b038211176103cb57604052565b90601f801991011681019081106001600160401b038211176103cb57604052565b6040519061044f826103b0565b565b6001600160401b0381116103cb57601f01601f191660200190565b92919261047882610451565b916104866040519384610421565b8294818452818301116104a3578281602093846000960137010152565b600080fd5b9080601f830112156104a3578160206104c39335910161046c565b90565b60206003198201126104a357600435906001600160401b0382116104a3576104c3916004016104a8565b60005b8381106105035750506000910152565b81810151838201526020016104f3565b9060209161052c815180928185528580860191016104f0565b601f01601f1916010190565b346104a35760208061055161054c366104c6565b61493d565b01519060409182519180830181845282518091528484019180868360051b8701019401926000965b8388106105865786860387f35b909192939483806105bc600193603f198b820301875285838b5163ffffffff60e01b815116845201519181858201520190610513565b970193019701969093929193610579565b6001600160e01b03198116036104a357565b346104a35760203660031901126104a3576106466004356105ff816105cd565b6001600160e01b031981166301ffc9a760e01b811491908215610696575b8215610685575b8215610674575b821561064a575b505060405190151581529081906020820190565b0390f35b63152a902d60e11b1491508115610664575b503880610632565b61066e9150613988565b3861065c565b915061067f81613988565b9161062b565b635b5e139f60e01b81149250610624565b6380ac58cd60e01b8114925061061d565b6001600160a01b038116036104a357565b602435906001600160601b03821682036104a357565b604435906001600160601b03821682036104a357565b346104a35760403660031901126104a357600435610701816106a7565b6107096106b8565b90610712612931565b6001600160601b0382166127108082116107ae5750506001600160a01b038116156107915761076861078f92610758610749610442565b6001600160a01b039094168452565b6001600160601b03166020830152565b805160209091015160a01b6001600160a01b0319166001600160a01b039190911617600955565b005b604051635b6cc80560e11b815260006004820152602490fd5b0390fd5b6044925060405191636f483d0960e01b835260048301526024820152fd5b9060206104c3928181520190610513565b346104a3576000806003193601126108b657604051816002546107ff816119a3565b8084529060019081811690811561088e5750600114610835575b6106468461082981880382610421565b604051918291826107cc565b60028352602094507f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b82841061087b5750505081610646936108299282010193610819565b805485850187015292850192810161085f565b61064696506108299450602092508593915060ff191682840152151560051b82010193610819565b80fd5b346104a35760203660031901126104a357600435600054811080610914575b15610902576000908152600660209081526040918290205491516001600160a01b03909216825290f35b6040516333d1c03960e21b8152600490fd5b50600081815260046020526040902054600160e01b16156108d8565b60403660031901126104a357600435610948816106a7565b6024356001600160a01b038061095d83613edb565b16908133036109a8575b600093838552600660205261097f8160408720612b89565b16907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258480a480f35b81600052600760205260ff6109c13360406000206128bf565b5416610967576040516367d9dca160e11b8152600490fd5b346104a35760003660031901126104a35760206000546001549003604051908152f35b346104a35760003660031901126104a3576040517f000000000000000000000000aefeec23144403a35b3a28e3416fcd7cea0014806001600160a01b03168152602090f35b906040610a6c610a5a8451606085526060850190610513565b60208501518482036020860152610513565b928101516001600160a01b031691015290565b346104a35760203660031901126104a357610646610aa7600435610aa2816105cd565b614a41565b604051918291602083526020830190610a41565b60609060031901126104a357600435610ad3816106a7565b90602435610ae0816106a7565b9060443590565b61078f610af336610abb565b91613f4a565b346104a35760203660031901126104a3576020610b17600435613097565b604051908152f35b346104a35760203660031901126104a35760043560005260086020526020600160406000200154604051908152f35b346104a35760403660031901126104a357600435600052600a602052604060002060405190610b7c826103b0565b546001600160a01b03811680835260a09190911c602083015215610bea575b6020810151610bce9061271090610bbd906001600160601b0316602435612be4565b92519204916001600160a01b031690565b604080516001600160a01b039290921682526020820192909252f35b50610bf3612ba8565b610b9b565b346104a35760403660031901126104a35761078f602435600435610c1b826106a7565b806000526008602052610c35600160406000200154612a33565b612a55565b346104a35760403660031901126104a3576024356001600160401b0381116104a357610c6d61078f9136906004016104a8565b610c75612931565b6004356135ad565b346104a35760403660031901126104a357602435610c9a816106a7565b6001600160a01b0380610cab6139e8565b1690821603610cc05761078f90600435612ad8565b60405163334bd91960e11b8152600490fd5b346104a35760403660031901126104a357600435610cef816106a7565b602435610cfa6129a1565b600054818101809111610d475760125410610d185761078f91614393565b60405162461bcd60e51b815260206004820152600760248201526621546f6b656e7360c81b6044820152606490fd5b612bce565b61078f610d5836610abb565b9060405192610d66846103eb565b60008452614261565b346104a35760203660031901126104a357600435610d8c81613edb565b60008281526006602052604090208054916001600160a01b03811691338085149084141715610dba565b1590565b610e6d575b600093610dcb84614094565b610e64575b50610dda826128a5565b80546001600160801b030190554260a01b8217600360e01b17610dfc8561159f565b55600160e11b811615610e31575b5060008051602061519c8339815191528280a461078f610e2c60015460010190565b600155565b60018401610e3e8161159f565b5415610e4b575b50610e0a565b83548114610e4557610e5c9061159f565b553880610e45565b83905538610dd0565b610e8c610db6610e8533610e808761288b565b6128bf565b5460ff1690565b15610dbf57604051632ce44b5f60e11b8152600490fd5b346104a35760203660031901126104a3576020610ec160043561330c565b6040519015158152f35b805190610ee060409283855283850190610a41565b90602080910151938181840391015283519182815281810182808560051b8401019601946000925b858410610f19575050505050505090565b909192939495968580610f51600193601f1986820301885286838d5163ffffffff60e01b815116845201519181858201520190610513565b990194019401929594939190610f08565b602080820190808352835180925260408301928160408460051b8301019501936000915b848310610f965750505050505090565b9091929394958480610fb4600193603f198682030187528a51610ecb565b9801930193019194939290610f86565b346104a3576000806003193601126108b657604051630940198960e31b81529080826004817f000000000000000000000000aefeec23144403a35b3a28e3416fcd7cea0014806001600160a01b03165afa91821561117b578192611157575b5081519161102f615107565b80519280815b86811061112257506110536110589161104e888861328e565b612c06565b614774565b948193825b8281106110c757505050915b83831061107e57604051806106468782610f62565b6110bb6110c1916110a061109b6110958787612d20565b516147c4565b614911565b6110aa8289612d20565b526110b58188612d20565b50613280565b92613280565b91611069565b6110df610db66110d78385612d20565b515151614f68565b6110f2575b6110ed90613280565b61105d565b9461111a6110ed916111048885612d20565b5161110f828c612d20565b526110b5818b612d20565b9590506110e4565b61112f6110d78287612d20565b611142575b61113d90613280565b611035565b9061114f61113d91613280565b919050611134565b6111749192503d8084833e61116c8183610421565b81019061469e565b9038611023565b613c68565b346104a35760203660031901126104a357602060043561119f816106a7565b6040519060018060a01b03807f000000000000000000000000c82bbe41f2cf04e3a8efa18f7032bdd7f6d98a81169116148152f35b346104a35760603660031901126104a3576004356024356111f4816106a7565b6111fc6106ce565b611204612931565b6127106001600160601b0382168181116112935750506001600160a01b038216156112735761078f9261125e61126e9261124e61123f610442565b6001600160a01b039096168652565b6001600160601b03166020850152565b600052600a602052604060002090565b6139b4565b604051634b4f842960e11b81526004810184905260006024820152604490fd5b60649185916040519263dfd1fc1b60e01b8452600484015260248301526044820152fd5b346104a35760203660031901126104a35760206001600160a01b036112dd600435613edb565b16604051908152f35b346104a35760003660031901126104a3576020600f54604051908152f35b346104a35760203660031901126104a357600435611321816106a7565b6001600160a01b0316801561135157600052600560205260206001600160401b0360406000205416604051908152f35b6040516323d3ad8160e21b8152600490fd5b346104a3576000806003193601126108b65761137d612b48565b601380546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b9181601f840112156104a3578235916001600160401b0383116104a357602083818601950101116104a357565b906003196040818401126104a3576004356001600160401b03918282116104a35760809082860301126104a357600401926024359182116104a357611435916004016113c1565b9091565b346104a357611447366113ee565b91906114616114596060840184612c82565b81019061358e565b926001600160a01b039091169183156115065760005491611482858461328e565b60125410610d1857610646957fff097c7d8b1957a4ff09ef1361b5fb54dcede3941ba836d0beb9d10bec725de6926114b992613b39565b936114c48185614393565b6114db6114cf6139e8565b6001600160a01b031690565b60408051948552602085019290925292a36040516001600160a01b0390911681529081906020820190565b60405162461bcd60e51b815260206004820152600360248201526271747960e81b6044820152606490fd5b346104a35760206001600160a01b03604061154e61054c366104c6565b51015116604051908152f35b346104a35760003660031901126104a3576040517f000000000000000000000000c82bbe41f2cf04e3a8efa18f7032bdd7f6d98a816001600160a01b03168152602090f35b6000526004602052604060002090565b7f8502233096d909befbda0999bb8ea2f3a6be3c138b9fbf003752a4c8bce86f6c60005260086020527f85da32aea425a83be1133c4e958580985fa04602ddf03ad35008a70703b20eb790565b346104a35760203660031901126104a3576004356000526011602052602060ff604060002054166040519015158152f35b346104a3576000806003193601126108b6576116d79061166c7f5369676e6174757265416374696f6e000000000000000000000000000000000f612ea3565b6116957f3100000000000000000000000000000000000000000000000000000000000001612f9b565b91604051916116a3836103eb565b818352604051948594600f60f81b86526116c960209360e08589015260e0880190610513565b908682036040880152610513565b904660608601523060808601528260a086015284820360c08601528080855193848152019401925b82811061170e57505050500390f35b8351855286955093810193928101926001016116ff565b346104a35760003660031901126104a3576013546040516001600160a01b039091168152602090f35b346104a35760403660031901126104a357602060ff611786602435611772816106a7565b6004356000526008845260406000206128bf565b54166040519015158152f35b346104a3576117a0366104c6565b6117a8612931565b80516001600160401b0381116103cb576117cc816117c76015546119a3565b61333e565b602080601f8311600114611809575081926000926117fe575b5050600019600383901b1c191660019190911b17601555005b0151905038806117e5565b6015600052601f198316939091907f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec475926000905b868210611874575050836001951061185b575b505050811b01601555005b015160001960f88460031b161c19169055388080611850565b8060018596829496860151815501950193019061183d565b346104a3576000806003193601126108b657604051816003546118ae816119a3565b8084529060019081811690811561088e57506001146118d7576106468461082981880382610421565b60038352602094507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b82841061191d5750505081610646936108299282010193610819565b8054858501870152928501928101611901565b9060406003198301126104a35760043591602435906001600160401b0382116104a357611435916004016113c1565b346104a35761064661197961197336611930565b916131d6565b604051918291602083526020830190610513565b634e487b7160e01b600052600060045260246000fd5b90600182811c921680156119d3575b60208310146119bd57565b634e487b7160e01b600052602260045260246000fd5b91607f16916119b2565b90600092918054916119ee836119a3565b918282526001938481169081600014611a505750600114611a10575b50505050565b90919394506000526020928360002092846000945b838610611a3c575050505001019038808080611a0a565b805485870183015294019385908201611a25565b9294505050602093945060ff191683830152151560051b01019038808080611a0a565b346104a35760203660031901126104a357600435600052600e602052610646611aa96119796040600020604051928380926119dd565b0382610421565b346104a35760003660031901126104a357602060405160008152f35b346104a35760403660031901126104a357600435611ae9816106a7565b602435908115158092036104a357336000526007602052611b0e8160406000206128bf565b60ff1981541660ff841617905560405191825260018060a01b0316907f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b602080820190808352835180925260408301928160408460051b8301019501936000915b848310611b865750505050505090565b9091929394958480611ba4600193603f198682030187528a51610513565b9801930193019194939290611b76565b346104a35760203660031901126104a3576001600160401b036004358181116104a357366023820112156104a35780600401359182116104a3573660248360051b830101116104a357610646916024611c0d9201612d34565b60405191829182611b52565b60803660031901126104a357600435611c31816106a7565b602435611c3d816106a7565b606435916001600160401b0383116104a357611c6061078f9336906004016104a8565b9160443591614261565b346104a357610646611c7e61054c366104c6565b604051918291602083526020830190610ecb565b346104a3576040611cab611ca5366113ee565b91613a41565b825191151582526001600160a01b03166020820152f35b6001600160401b0381116103cb5760051b60200190565b81601f820112156104a357803590611cf082611cc2565b92604092611d0084519586610421565b808552602093848087019260051b850101938385116104a357858101925b858410611d2f575050505050505090565b6001600160401b0384358181116104a35783019184601f1984890301126104a3578451611d5b816103b0565b89840135611d68816105cd565b8152858401359283116104a357611d86888b809695819601016104a8565b83820152815201930192611d1e565b600319906020818301126104a3576004908135916001600160401b038084116104a35760408585850301126104a35760405194611dd1866103b0565b848301358281116104a35760609086019182860301126104a35760405190611df8826103d0565b838101358381116104a3578585611e11928401016104a8565b82526024810135908382116104a357611e3086866044948401016104a8565b60208401520135611e40816106a7565b6040820152855260248401359081116104a357611e5e930101611cd9565b602082015290565b346104a357611e7436611d95565b611e84611e7f6144dc565b614485565b805151611e9b611e9382614809565b541515614d42565b611eb76002611ea9836147c4565b01546001600160a01b031690565b82516040908101516001600160a01b0393919284169190611edc908516831415614da0565b611eef8551611eea836147c4565b614b72565b6003611f0481611efe846147c4565b01614889565b805190611f1a83611f14866147c4565b01614e47565b60005b82811061207357505050602094858701918251519760005b898110611f3e57005b80855190611f4b91612d20565b51611f5590614c15565b8982875190611f6391612d20565b5101518951808c81019283611f7791612cd0565b03601f1981018252611f899082610421565b5190206001600160e01b031991611fa591831690831614614c23565b825182875190611fb491612d20565b51611fbe90614c15565b611fc790614a09565b90611fd191614b72565b83611fdb886147c4565b0182875190611fe991612d20565b51611ff391614cf6565b82518901516001600160a01b031690888388519061201091612d20565b5161201a90614c15565b918c858a519061202991612d20565b51015192888d519283921695169361204190826107cc565b037f7f4649aa14a7e9abd7f21a02ea35b32c907d59bb701c52c0e028ddf57533c74c91a461206e90613280565b611f35565b8061209a61209561209061208a61209f9587612d20565b51614c15565b614a09565b614e9d565b613280565b611f1d565b346104a35760203660031901126104a357610646611979600435613733565b346104a35760203660031901126104a35760206004356120e2816105cd565b6001600160a01b03906040906120f790614a41565b015116604051908152f35b346104a35761211036611930565b916121196129a1565b61212281613097565b61212d8484836131d6565b9261214760405161213d816103eb565b60008152836133bd565b61215184836135ad565b6121596139e8565b906000194301438111610d47576121b66094610646986121ca95604051948286936020850198893783019144602084015260018060601b03199060601b166040830152426054830152406074820152036074810184520182610421565b519020916000526014602052604060002090565b557f6df1d8db2a036436ffe0b2d1833f2c5f1e624818dfce2578c0faa4b83ef9998d604051806121fa85826107cc565b0390a2604051918291826107cc565b346104a35760603660031901126104a3576001600160401b036004356024358281116104a35761223d9036906004016113c1565b90916044358481116104a3576122579036906004016113c1565b9390946122626129a1565b8461236e575b508115612341576012549261227e36828461046c565b9280850195868611610d4757600f5497600160401b8910156103cb5761232161231c61232e9461230d7f2a0365091ef1a40953c670dce28177e37520648a6fdc91506bffac0ab045570d996122fa8d6106469f8060016122e19201600f55613055565b90919082549060031b91821b91600019901b1916179055565b8c600052601060205260406000206134e6565b6123168b601255565b8961328e565b612bf7565b93604051958695866134ba565b0390a26040519081529081906020820190565b60405162461bcd60e51b81526020600482015260056024820152640c08185b5d60da1b6044820152606490fd5b8486016040878203126104a35786359182116104a35761238f9187016104a8565b511515806123ca575b6123a3575b38612268565b601254828101809111610d47576123c5906123bf36878961046c565b906133bd565b61239d565b5060208501351515612398565b346104a35760403660031901126104a35761078f6024356004356123fa826106a7565b806000526008602052612414600160406000200154612a33565b612ad8565b346104a35761242736611d95565b612432611e7f6144dc565b80515161244661244182614ede565b614b14565b6124548251611eea836147c4565b81516040908101516001600160a01b0392906124739084161515614ba8565b602092838501908151519560005b87811061248a57005b80846125086124f66124e98a6124cb6124d98e806124ba8a6124b361208a6125cb9e8d51612d20565b9a51612d20565b510151935192839182018095612cd0565b03601f198101835282610421565b5190206001600160e01b03191690565b6001600160e01b03191690565b6001600160e01b031992831614614c23565b61252a6125246114cf6002611ea961209061208a888d51612d20565b15614c8b565b6125408451611eea61209061208a868b51612d20565b612561600361254e896147c4565b0161255a848951612d20565b5190614cf6565b83518801516001600160a01b0316907fb5a3e9571e367979a4a14de42b248d0837c26fd8e879846062abcf7cee17127361259f61208a858a51612d20565b918b6125ac868b51612d20565b510151926125c3898d5193849316961694826107cc565b0390a3613280565b612481565b346104a35760403660031901126104a3576001600160401b036004358181116104a3576126019036906004016104a8565b906024359081116104a357610646916126216119799236906004016113c1565b9161329b565b346104a3576000806003193601126108b65760405181601554612649816119a3565b8084529060019081811690811561088e5750600114612672576106468461082981880382610421565b60158352602094507f55f448fdea98c4d29eb340757ef0a66cd03dbb9538908a6a81d96026b71ec4755b8284106126b85750505081610646936108299282010193610819565b805485850187015292850192810161269c565b346104a35760403660031901126104a357602060ff6117866004356126ef816106a7565b602435906126fc826106a7565b6001600160a01b0316600090815260078552604090206128bf565b346104a357612725366104c6565b612730611e7f6144dc565b61274161273c8261503a565b614d42565b61274f6002611ea9836147c4565b61276e6127696127636003611efe866147c4565b936147c4565b614ebb565b8151906001600160a01b031660005b82811061278657005b8061279761208a6127fa9387612d20565b837f5968261591c9d57680edfe0bed3bb6a37ab7fb354578affd1e5be8ce18e6c9d36127e460206127c8868b612d20565b5101516040516001600160e01b031990951694918291826107cc565b0390a361209a61209561209061208a8489612d20565b61277d565b346104a35760203660031901126104a35760043561281c816106a7565b612824612b48565b6001600160a01b0390811690811561287257601380546001600160a01b031981168417909155167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b604051631e4fbdf760e01b815260006004820152602490fd5b6001600160a01b0316600090815260076020526040902090565b6001600160a01b0316600090815260056020526040902090565b9060018060a01b0316600052602052604060002090565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6600052600860205260ff9061292c907f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb6128bf565b541690565b6129396139e8565b60008052600860205260ff61296e827f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c76128bf565b5416156129785750565b60405163e2517d3f60e01b81526001600160a01b03909116600482015260006024820152604490fd5b6129a96139e8565b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a66000819052600860205260ff612a00837f51a495916474fe1a0c0fcfb65a8a97682b84a054118858cdd1f5dfd7fc0919eb6128bf565b541615612a0b575050565b60405163e2517d3f60e01b81526001600160a01b039092166004830152602482015260449150fd5b612a3b6139e8565b9080600052600860205260ff612a008360406000206128bf565b600090808252600860205260ff612a6f84604085206128bf565b5416612ad2578082526008602052612a8a83604084206128bf565b805460ff191660011790557f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d6001600160a01b0380612ac76139e8565b1694169280a4600190565b50905090565b600090808252600860205260ff612af284604085206128bf565b541615612ad2578082526008602052612b0e83604084206128bf565b805460ff191690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b6001600160a01b0380612ac76139e8565b6013546001600160a01b0390811681612b5f6139e8565b1603612b685750565b602490612b736139e8565b60405163118cdaa760e01b815291166004820152fd5b80546001600160a01b0319166001600160a01b03909216919091179055565b60405190612bb5826103b0565b6009546001600160a01b038116835260a01c6020830152565b634e487b7160e01b600052601160045260246000fd5b81810292918115918404141715610d4757565b600019810191908211610d4757565b91908203918211610d4757565b90612c1d82611cc2565b612c2a6040519182610421565b8281528092612c3b601f1991611cc2565b019060005b828110612c4c57505050565b806060602080938501015201612c40565b6000198114610d475760010190565b634e487b7160e01b600052603260045260246000fd5b903590601e19813603018212156104a357018035906001600160401b0382116104a3576020019181360383136104a357565b90821015612ccb576114359160051b810190612c82565b612c6c565b90612ce3602092828151948592016104f0565b0190565b6020908161044f939594612d148760405198899585870137840191838301600081528151948592016104f0565b01038085520183610421565b8051821015612ccb5760209160051b010190565b6001600160a01b03612d446139e8565b1633149160008093600014612dc45750604051612d60816103eb565b83815283368137905b612d7281612c13565b935b818110612d82575050505090565b80612da4612d9e85612d98612dbf95878a612cb4565b90612ce7565b30612e27565b612dae8288612d20565b52612db98187612d20565b50612c5d565b612d74565b36601319810194508411610d475760405190612ddf826103b0565b60148252601481956020840137603482015290612d69565b3d15612e22573d90612e0882610451565b91612e166040519384610421565b82523d6000602084013e565b606090565b6000806104c393602081519101845af4612e3f612df7565b9190612e675750805115612e5557805190602001fd5b604051630a12f52160e11b8152600490fd5b81511580612e9a575b612e78575090565b604051639996b31560e01b81526001600160a01b039091166004820152602490fd5b50803b15612e70565b60ff8114612ee15760ff811690601f8211612ecf5760405191612ec5836103b0565b8252602082015290565b604051632cd44ac360e21b8152600490fd5b50604051600b54816000612ef4836119a3565b808352600193808516908115612f7a5750600114612f1a575b506104c392500382610421565b600b60009081527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db994602093509091905b818310612f625750506104c3935082010138612f0d565b85548784018501529485019486945091830191612f4b565b90506104c394506020925060ff191682840152151560051b82010138612f0d565b60ff8114612fbd5760ff811690601f8211612ecf5760405191612ec5836103b0565b50604051600c54816000612fd0836119a3565b808352600193808516908115612f7a5750600114612ff557506104c392500382610421565b600c60009081527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c794602093509091905b81831061303d5750506104c3935082010138612f0d565b85548784018501529485019486945091830191613026565b600f54811015612ccb57600f60005260206000200190600090565b60008051602061517c8339815191528054821015612ccb5760005260206000200190600090565b600f548110156130cc57600f6000527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac802015490565b60405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606490fd5b9092919261310e81610451565b9161311c6040519384610421565b8294828452828201116104a357602061044f9301906104f0565b91906040838203126104a35782516001600160401b0381116104a357830181601f820112156104a357602091818361317093519101613101565b92015190565b92602080959461318e839594828151948592016104f0565b01918237019081520190565b156131a157565b60405162461bcd60e51b815260206004820152600d60248201526c496e636f7272656374206b657960981b6044820152606490fd5b92919092600052600e602052611aa96131f96040600020604051928380926119dd565b80511561324757816124cb61323e61322961044f95613222866020808c99518301019101613136565b969061329b565b96604051928391602083019546918b88613176565b5190201461319a565b60405162461bcd60e51b8152602060048201526011602482015270139bdd1a1a5b99c81d1bc81c995d99585b607a1b6044820152606490fd5b9060018201809211610d4757565b91908201809211610d4757565b909291928151916040918251956020938486890101815285885260005b8681106132c85750505050505050565b815186810190848683376132ec8482878101868c820152038a810184520182610421565b5190208682870101511886828b010152858101809111156132b857612bce565b600052600e6020526133226040600020546119a3565b151590565b818110613332575050565b60008155600101613327565b90601f821161334b575050565b61044f9160156000526020600020906020601f840160051c83019310613379575b601f0160051c0190613327565b909150819061336c565b9190601f811161339257505050565b61044f926000526020600020906020601f840160051c8301931061337957601f0160051c0190613327565b9190916000526020600e81526040600020908351906001600160401b0382116103cb576133f4826133ee85546119a3565b85613383565b80601f831160011461342e575081929394600092613423575b50508160011b916000199060031b1c1916179055565b01519050388061340d565b90601f1983169561344485600052602060002090565b926000905b88821061348157505083600195969710613468575b505050811b019055565b015160001960f88460031b161c1916905538808061345e565b80600185968294968601518155019501930190613449565b908060209392818452848401376000828201840152601f01601f1916010190565b93916104c395936134d8928652606060208701526060860191613499565b926040818503910152613499565b91909182516001600160401b0381116103cb5761350d8161350784546119a3565b84613383565b602080601f831160011461353d5750819293946000926134235750508160011b916000199060031b1c1916179055565b90601f1983169561355385600052602060002090565b926000905b8882106135765750508360019596971061346857505050811b019055565b80600185968294968601518155019501930190613558565b91908260409103126104a357602082356135a7816106a7565b92013590565b80600052601160205260ff60406000205416613616576135fb7f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c9282600052601060205260406000206134e6565b6136048161369a565b604080519182526020820192909252a1565b60405162461bcd60e51b815260206004820152600c60248201526b2130ba31b410333937bd32b760a11b6044820152606490fd5b60405190600f548083528260209182820190600f60005283600020936000905b8282106136805750505061044f92500383610421565b85548452600195860195889550938101939091019061366a565b600f54906136a661364a565b600091825b8481106136e95760405162461bcd60e51b815260206004820152600f60248201526e125b9d985b1a590818985d18da1259608a1b6044820152606490fd5b6136f38184612d20565b5182146137085761370390612c5d565b6136ab565b91929350508061371757505090565b9091506000198101908111610d475761372f91612d20565b5190565b61373c8161381e565b9061374683613883565b926137508261330c565b1561377f575050506104c3613772916124cb6040519384926020840190612cd0565b600360fc1b815260010190565b9061378a9291613904565b6040519060a08201604052608082019060008252905b6000190190600a9060308282060183530490816137a05790506137e2926137e86104c3936080601f199485810192030181526040519586936020850190612cd0565b90612cd0565b03908101835282610421565b60609060208152600f60208201526e125b9d985b1a59081d1bdad95b9259608a1b60408201520190565b90600f549161382b61364a565b9060005b84811061384f5760405162461bcd60e51b8152806107aa600482016137f4565b6138598184612d20565b51821061387157600181018091111561382f57612bce565b9350508261387e91612d20565b519190565b90600f549161389061364a565b600091825b8581106138b55760405162461bcd60e51b8152806107aa600482016137f4565b6138bf8184612d20565b5182106138d757600181018091111561389557612bce565b611aa99495506138ec91506104c39392612d20565b518152601060205260408091209051928380926119dd565b919080600052601460205260406000205480156139825760009280613963575b5082820391808311610d4757831461394d578190068301809311610d47576104c392069061328e565b634e487b7160e01b600052601260045260246000fd5b9092506000198101908111610d475761397b90613097565b9138613924565b50505090565b63ffffffff60e01b16637965db0b60e01b81149081156139a6575090565b6301ffc9a760e01b14919050565b90602060018060a01b03916139cc8382511685612b89565b0151825490911660a09190911b6001600160a01b031916179055565b337f000000000000000000000000c82bbe41f2cf04e3a8efa18f7032bdd7f6d98a816001600160a01b03161480613a36575b15613a32576013193601368111610d47573560601c90565b3390565b506014361015613a1a565b91610e85613aff610db692613af9613b1095613af1613a5f89613b25565b613a6b60208b01613b25565b90613a89613a8260408d01359c6060810190612c82565b369161046c565b602081519101206040519160208301937f242b17107e6aef17754836dd680cb66bbf39e46a5f20952950acbbae68643d02855260018060801b0380921660408501521660608301528b608083015260a082015260a08152613ae981610406565b519020613d9b565b92369161046c565b90613c16565b93600052600d602052604060002090565b80613b185791565b50613b22816128d6565b91565b356001600160801b03811681036104a35790565b9291613b459184613a41565b929015613be757613b5581613b25565b426001600160801b03909116118015613bc4575b613b9557613b88604061044f920135600052600d602052604060002090565b805460ff19166001179055565b60405162461bcd60e51b8152602060048201526007602482015266195e1c1a5c995960ca1b6044820152606490fd5b50613be0613bd460208301613b25565b6001600160801b031690565b4211613b69565b60405162461bcd60e51b8152602060048201526007602482015266125b9d985b1a5960ca1b6044820152606490fd5b6104c391613c2391613c2c565b90929192613d0e565b8151919060418303613c5d57613c5692506020820151906060604084015193015160001a90613c74565b9192909190565b505060009160029190565b6040513d6000823e3d90fd5b91906fa2a8918ca85bafe22016d0b997e4df60600160ff1b038411613ce257926020929160ff608095604051948552168484015260408301526060820152600092839182805260015afa1561117b5780516001600160a01b03811615613cd957918190565b50809160019190565b50505060009160039190565b60041115613cf857565b634e487b7160e01b600052602160045260246000fd5b613d1781613cee565b80613d20575050565b613d2981613cee565b60018103613d435760405163f645eedf60e01b8152600490fd5b613d4c81613cee565b60028103613d6d5760405163fce698f760e01b815260048101839052602490fd5b80613d79600392613cee565b14613d815750565b6040516335e2f38360e21b81526004810191909152602490fd5b604290613da6613dc1565b906040519161190160f01b8352600283015260228201522090565b307f00000000000000000000000038b4852c43fede65b08a7b7e94959009905982516001600160a01b03161480613eb2575b15613e1c577f46ee964e800d019bf60d6eaa553941ad0f3b891c1932da206c0ca7c45982248790565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f9d4ffaa97baca5653914910a43096d3910699e440d067aae25095cef149d7c4e60408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a08152613eac81610406565b51902090565b507f00000000000000000000000000000000000000000000000000000000000000014614613df3565b8060009081548110613efa575b604051636f96cda160e11b8152600490fd5b81526004906020918083526040928383205494600160e01b861615613f2157505050613ee8565b93929190935b8515613f3557505050505090565b60001901808352818552838320549550613f27565b90613f5483613edb565b6001600160a01b038381169282821684900361408357600086815260066020526040902080549092613f956001600160a01b03881633908114908414171590565b614059575b821695861561404757613fcd93613fc092613fb585846141cf565b61403d575b506128a5565b80546000190190556128a5565b80546001019055600160e11b4260a01b84178117613fea8661159f565b55811615614009575b5060008051602061519c833981519152600080a4565b600184016140168161159f565b5415614023575b50613ff3565b600054811461401d576140359061159f565b55388061401d565b6000905538613fba565b604051633a954ecd60e21b8152600490fd5b61406c610db6610e8533610e808b61288b565b15613f9a57604051632ce44b5f60e11b8152600490fd5b60405162a1148160e81b8152600490fd5b61409c6115af565b9060009182805260205260ff6040832054161580614139575b80614132575b6140c3575050565b6140d160ff91610e806115af565b5416159081614113575b506140e257565b60405162461bcd60e51b815260206004820152600960248201526810aa2920a729a322a960b91b6044820152606490fd5b60ff91506040906141226115af565b81805260205220541615386140db565b50816140bb565b506001600160a01b03811615156140b5565b6141536115af565b60009081805260205260ff60408220541615806141c8575b806141b6575b614179575050565b604060ff916141866115af565b81805260205220541615908161419d57506140e257565b60ff91506141ad90610e806115af565b541615386140db565b506001600160a01b0382161515614171565b508061416b565b6141d76115af565b600080526020526141f060ff6040600020541615151590565b8061424f575b8061423d575b614204575050565b610db6610e8561421692610e806115af565b908161422357506140e257565b6142379150610e85610db691610e806115af565b386140db565b506001600160a01b03821615156141fc565b506001600160a01b03811615156141f6565b92919061426f828286613f4a565b803b61427b5750505050565b614284936142ea565b156142925738808080611a0a565b6040516368d2bf6b60e11b8152600490fd5b908160209103126104a357516104c3816105cd565b6001600160a01b0391821681529116602082015260408101919091526080606082018190526104c392910190610513565b92602091614313936000604051809681958294630a85bd0160e11b9a8b855233600486016142b9565b03926001600160a01b03165af160009181614363575b5061435557614336612df7565b80519081614350576040516368d2bf6b60e11b8152600490fd5b602001fd5b6001600160e01b0319161490565b61438591925060203d811161438c575b61437d8183610421565b8101906142a4565b9038614329565b503d614373565b906000908154928115614434576143a98161414b565b6143b2816128a5565b80546001600160401b0184020190556001600160a01b0316906001904260a01b81831460e11b1783176143e48661159f565b558401938160008051602061519c83398151915291808587858180a4015b85810361442557505050156144145755565b604051622e076360e81b8152600490fd5b8083918587858180a401614402565b60405163b562e8dd60e01b8152600490fd5b600080806001600160a01b03604061446883356001600160e01b031916614a41565b015116368280378136915af43d82803e15614481573d90f35b3d90fd5b1561448c57565b60405162461bcd60e51b815260206004820152602260248201527f42617365526f757465723a2063616c6c6572206e6f7420617574686f72697a65604482015261321760f11b6064820152608490fd5b60ff61292c6144e96139e8565b6000805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c76128bf565b9080601f830112156104a35781516104c392602001613101565b9190916060818403126104a3576040519061454c826103d0565b81938151916001600160401b03928381116104a3578261456d918301614518565b845260208101519283116104a35761458b6040939284938301614518565b602085015201519161459c836106a7565b0152565b919060409283818303126104a35783516145b9816103b0565b80948251936001600160401b03948581116104a357816145da918601614532565b835260209384810151908682116104a357019181601f840112156104a35782519061460482611cc2565b9661461182519889610421565b828852868089019360051b860101948486116104a357878101935b86851061463e57505050505050500152565b84518381116104a35782019084601f1983890301126104a357845190614663826103b0565b8a830151614670816105cd565b825285830151918583116104a35761468f898d80969581960101614518565b8382015281520194019361462c565b9060209081838203126104a35782516001600160401b03938482116104a3570181601f820112156104a35780516146d481611cc2565b946146e26040519687610421565b818652848087019260051b840101938085116104a357858401925b85841061470e575050505050505090565b83518381116104a3578791614728848480948a01016145a0565b8152019301926146fd565b60405190614740826103d0565b600060408360608152606060208201520152565b60405190614761826103b0565b606060208361476e614733565b81520152565b9061477e82611cc2565b61478b6040519182610421565b828152809261479c601f1991611cc2565b019060005b8281106147ad57505050565b6020906147b8614754565b828285010152016147a1565b60206147dd9181604051938285809451938492016104f0565b81017f1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee0087581520301902090565b60206148229181604051938285809451938492016104f0565b81016000805160206151bc83398151915281520301902090565b90604051614849816103d0565b60408193815161485d81611aa981856119dd565b8352815161487281611aa981600186016119dd565b6020840152600201546001600160a01b0316910152565b90815461489581611cc2565b926040936148a585519182610421565b828152809460208092019260005281600020906000935b8585106148cb57505050505050565b60028460019284516148dc816103b0565b865460e01b6001600160e01b031916815285516148ff81611aa981898c016119dd565b838201528152019301940193916148bc565b9060405161491e816103b0565b6020614938600383956149308161483c565b855201614889565b910152565b614945614754565b5061494f81614809565b5460009015614965575061109b6104c3916147c4565b80614984926040518094819263611383f760e11b8352600483016107cc565b03817f000000000000000000000000aefeec23144403a35b3a28e3416fcd7cea0014806001600160a01b03165afa91821561117b5781926149c457505090565b909291503d8084833e6149d78183610421565b810190602081830312614a05578051906001600160401b038211614a01576104c3939450016145a0565b8480fd5b8380fd5b63ffffffff60e01b166000527f1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee00876602052604060002090565b614a49614733565b50614a5b614a5682614a09565b61483c565b604081015190916001600160a01b039160009190831615614a7c5750505090565b81929350602460405180958193631097b48960e11b835263ffffffff60e01b1660048301527f000000000000000000000000aefeec23144403a35b3a28e3416fcd7cea001480165afa91821561117b578192614ad757505090565b909291503d8084833e614aea8183610421565b810190602081830312614a05578051906001600160401b038211614a01576104c393945001614532565b15614b1b57565b60405162461bcd60e51b815260206004820152602960248201527f457874656e73696f6e53746174653a20657874656e73696f6e20616c726561646044820152683c9032bc34b9ba399760b91b6064820152608490fd5b600261044f92614b838151846134e6565b614b946020820151600185016134e6565b604001516001600160a01b03169101612b89565b15614baf57565b60405162461bcd60e51b815260206004820152603860248201527f457874656e73696f6e53746174653a20616464696e6720657874656e73696f6e604482015277103bb4ba3437baba1034b6b83632b6b2b73a30ba34b7b71760411b6064820152608490fd5b516001600160e01b03191690565b15614c2a57565b60405162461bcd60e51b815260206004820152603360248201527f457874656e73696f6e53746174653a20666e2073656c6563746f7220616e642060448201527239b4b3b730ba3ab9329036b4b9b6b0ba31b41760691b6064820152608490fd5b15614c9257565b60405162461bcd60e51b815260206004820152603660248201527f457874656e73696f6e53746174653a20657874656e73696f6e20616c726561646044820152753c9032bc34b9ba39903337b910333ab731ba34b7b71760511b6064820152608490fd5b908154600160401b8110156103cb5760018101808455811015612ccb57602060019161044f946000528160002090831b0192805160e01c63ffffffff19855416178455015191016134e6565b15614d4957565b60405162461bcd60e51b815260206004820152602960248201527f457874656e73696f6e53746174653a20657874656e73696f6e20646f6573206e60448201526837ba1032bc34b9ba1760b91b6064820152608490fd5b15614da757565b60405162461bcd60e51b815260206004820152602960248201527f457874656e73696f6e53746174653a2072652d616464696e672073616d6520656044820152683c3a32b739b4b7b71760b91b6064820152608490fd5b614e0881546119a3565b9081614e12575050565b81601f60009311600114614e24575055565b908083918252614e43601f60208420940160051c840160018501613327565b5555565b805460009182815581614e5957505050565b6001600160ff1b0382168203610d475782526020822091600191821b8301925b838110614e865750505050565b808260029255614e97848201614dfe565b01614e79565b6002600091614eab81614dfe565b614eb760018201614dfe565b0155565b600361044f91611f1481614e9d565b9190614ed95761044f916134e6565b61198d565b614ee781614809565b54614f625760008051602061517c8339815191528054600160401b8110156103cb5760018101808355811015612ccb5781614f3084602093614f459560005284600020016134e6565b549281604051938285809451938492016104f0565b81016000805160206151bc83398151915281520301902055600190565b50600090565b6020614f819181604051938285809451938492016104f0565b81016000805160206151bc83398151915281520301902054151590565b60008051602061517c83398151915280548015615024576000190190614fc382613070565b614ed957614fd181546119a3565b9081614fdc57505055565b601f8211600114614fef57600091505555565b61501161502192826000526001601f6020600020920160051c82019101613327565b6000908082528160208120915555565b55565b634e487b7160e01b600052603160045260246000fd5b604051602081835161504f81838588016104f0565b6000805160206151bc83398151915290820190815203019020548015615100576000199181830191808311610d475760008051602061517c83398151915254938401938411610d475783836150b794600096036150bd575b5050506150b2614f9e565b614809565b55600190565b6150b26150e5916150f16150d36150f795613070565b50916150ec60405180968180966119dd565b0384610421565b613070565b90614eca565b553880806150a7565b5050600090565b60008051602061517c83398151915290815461512281611cc2565b9260409361513285519182610421565b828152809460208092019260005281600020906000935b85851061515857505050505050565b6001848192845161516d81611aa9818a6119dd565b81520193019401939161514956fe1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee00873ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef1a039940024227c284ceea7ab90e5603ce17de27c93816eef22d65b14ee00874a164736f6c6343000814000a

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

000000000000000000000000d8d7cc55608e0a72d18737852b89b8388d04870f00000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000018000000000000000000000000015a6bea0a36873d2bc9a47836fb111e18e46241f00000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000000000000000200000000000000000000000000c82bbe41f2cf04e3a8efa18f7032bdd7f6d98a8100000000000000000000000000000000000000000000000000000000000000195065746f706961204865726f657320436f6c6c656374696f6e000000000000000000000000000000000000000000000000000000000000000000000000000008504554204845524f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042697066733a2f2f6261666b726569686377626d6b6a68696d6679657176716b36697176766f3532783271326f716e6f37786264766d3569336665637869327372646d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _defaultAdmin (address): 0xd8d7cc55608e0A72D18737852b89b8388d04870f
Arg [1] : _name (string): Petopia Heroes Collection
Arg [2] : _symbol (string): PET HERO
Arg [3] : _contractURI (string): ipfs://bafkreihcwbmkjhimfyeqvqk6iqvvo52x2q2oqno7xbdvm5i3fecxi2srdm
Arg [4] : _royaltyRecipient (address): 0x15a6Bea0A36873d2bC9a47836FB111E18E46241f
Arg [5] : _royaltyBps (uint16): 500

-----Encoded View---------------
17 Constructor Arguments found :
Arg [0] : 000000000000000000000000d8d7cc55608e0a72d18737852b89b8388d04870f
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [4] : 00000000000000000000000015a6bea0a36873d2bc9a47836fb111e18e46241f
Arg [5] : 00000000000000000000000000000000000000000000000000000000000001f4
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000200
Arg [7] : 000000000000000000000000c82bbe41f2cf04e3a8efa18f7032bdd7f6d98a81
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000019
Arg [9] : 5065746f706961204865726f657320436f6c6c656374696f6e00000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [11] : 504554204845524f000000000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000042
Arg [13] : 697066733a2f2f6261666b726569686377626d6b6a68696d6679657176716b36
Arg [14] : 697176766f3532783271326f716e6f37786264766d3569336665637869327372
Arg [15] : 646d000000000000000000000000000000000000000000000000000000000000
Arg [16] : 0000000000000000000000000000000000000000000000000000000000000000


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

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