false
false

Contract Address Details

0xfB6d4eccAB107BfdBFd6EE78668ACdA3b55C2ACe

Contract Name
GenesisChampionFactory
Creator
0xbb411b–4efd4d at 0x4f17c1–7b3bd6
Balance
0 OAS ( )
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
810489
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
GenesisChampionFactory




Optimization enabled
true
Compiler version
v0.8.24+commit.e11b9ed9




Optimization runs
200
Verified at
2024-07-11T14:14:30.569942Z

Constructor Arguments

000000000000000000000000bb411bba014ee684428ded9581e773dd754efd4d

Arg [0] (address) : 0xbb411bba014ee684428ded9581e773dd754efd4d

              

src/GenesisChampionFactory.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.24;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {GenesisChampion} from "src/GenesisChampion.sol";
import {IGenesisChampionFactory} from "src/interfaces/IGenesisChampionFactory.sol";
import {GenesisChampionArgs} from "src/types/GenesisChampionArgs.sol";

contract GenesisChampionFactory is IGenesisChampionFactory, Ownable {

    /// @notice emitted after deploying a new instance of GenesisChampion
    event ContractCreated(address, uint256);

    /// @notice Mapping of deployed contracts addresses to their order of deployment
    mapping(address contractAddress => uint256 index) public deployedVersions;

    /// @notice Most recent deployment address
    address public lastDeployment;

    /// @notice Most recent deployment index
    uint256 public lastVersion;

    /// @notice Constructor only herits from Ownable
    constructor(address owner_) Ownable(owner_) {
    }

    /**
     * @inheritdoc IGenesisChampionFactory
     */
    function deploy(GenesisChampionArgs calldata _args) public onlyOwner returns (address, uint256) {
        // index is auto-incremental
        uint256 newIndex = lastVersion + 1;
        // Deploy a new instance of GenesisChampion
        GenesisChampion impl = new GenesisChampion(_args);
        // Update the deployments
        address newDeployment = address(impl);
        deployedVersions[newDeployment] = newIndex;
        lastDeployment = newDeployment;
        lastVersion = newIndex;
        // Emit the contract address
        emit ContractCreated(newDeployment, newIndex);
        return (newDeployment, newIndex);
    }

}
        

src/types/MintData.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.24;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

/**
 * @notice MintData holds the data required to a minting request
 * @param to address of the user receiving the token(s)
 * @param validity_start timestamp for signature's start of validity
 * @param validity_end timestamp for signature's end of validity
 * @param chain_id for replay attack protection
 * @param mint_amount total number of tokens to mint if available
 * @param user_nonce generated by Genesis' backend
 */
struct MintData {
    address to;
    uint256 validity_start;
    uint256 validity_end;
    uint256 chain_id;
    uint256 mint_amount;
    bytes32 user_nonce;
}
          

lib/openzeppelin-contracts/contracts/utils/Address.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

src/interfaces/IGenesisChampion.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.24;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

import {IGenesisBase} from "./IGenesisBase.sol";
import {IERC721} from "openzeppelinV4/token/ERC721/IERC721.sol";

/**
 * @title IGenesisChampion
 *
 * @notice Interface for the GenesisChampion contract, implementing minting and signature verification
 */
interface IGenesisChampion is IGenesisBase, IERC721 {

    /**
     * @notice mint allows an authorized MINTER_ROLE address to mint any amount of tokens for a recipient
     * @dev returns the first and last ID of tokens minted
     * @param to address of the recipient
     * @param amount of tokens to mint
     */
    function mint(address to, uint256 amount) external returns (uint256, uint256);

    /**
     * @notice defaultMaxCraftCount for each gen0 Champion
     */
    function defaultMaxCraftCount() external returns (uint256);
}
          

node_modules/@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OApp.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

// @dev Import the 'MessagingFee' and 'MessagingReceipt' so it's exposed to OApp implementers
// solhint-disable-next-line no-unused-import
import { OAppSender, MessagingFee, MessagingReceipt } from "./OAppSender.sol";
// @dev Import the 'Origin' so it's exposed to OApp implementers
// solhint-disable-next-line no-unused-import
import { OAppReceiver, Origin } from "./OAppReceiver.sol";
import { OAppCore } from "./OAppCore.sol";

/**
 * @title OApp
 * @dev Abstract contract serving as the base for OApp implementation, combining OAppSender and OAppReceiver functionality.
 */
abstract contract OApp is OAppSender, OAppReceiver {
    /**
     * @dev Constructor to initialize the OApp with the provided endpoint and owner.
     * @param _endpoint The address of the LOCAL LayerZero endpoint.
     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
     */
    constructor(address _endpoint, address _delegate) OAppCore(_endpoint, _delegate) {}

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol implementation.
     * @return receiverVersion The version of the OAppReceiver.sol implementation.
     */
    function oAppVersion()
        public
        pure
        virtual
        override(OAppSender, OAppReceiver)
        returns (uint64 senderVersion, uint64 receiverVersion)
    {
        return (SENDER_VERSION, RECEIVER_VERSION);
    }
}
          

lib/openzeppelin-contracts/contracts/access/AccessControl.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)

pragma solidity ^0.8.0;

/**
 * @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:
 * ```
 * 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(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 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
        }
    }
}
          

lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

src/types/GenesisChampionArgs.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.24;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

/**
 * @notice Constructor args required for the deployment of GenesisChampion
 * @param name of the contract
 * @param symbol of the contract
 * @param baseURI for metadatas
 * @param owner of the contract
 * @param minter address of the GenesisMinter contract
 * @param crafter address of the GenesisCrafter contract
 * @param vault address of the royalties vault
 * @param endpointL0 address of the LayerZero V2 endpoint used
 * @param defaultMaxCraftCount maximum craft count charges a Champion can use by default
 */
struct GenesisChampionArgs {
    string name;
    string symbol;
    string baseURI;
    address owner;
    address minter;
    address crafter;
    address vault;
    address endpointL0;
    uint256 defaultMaxCraftCount;
}
          

node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLibManager.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

struct SetConfigParam {
    uint32 eid;
    uint32 configType;
    bytes config;
}

interface IMessageLibManager {
    struct Timeout {
        address lib;
        uint256 expiry;
    }

    event LibraryRegistered(address newLib);
    event DefaultSendLibrarySet(uint32 eid, address newLib);
    event DefaultReceiveLibrarySet(uint32 eid, address newLib);
    event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);
    event SendLibrarySet(address sender, uint32 eid, address newLib);
    event ReceiveLibrarySet(address receiver, uint32 eid, address newLib);
    event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout);

    function registerLibrary(address _lib) external;

    function isRegisteredLibrary(address _lib) external view returns (bool);

    function getRegisteredLibraries() external view returns (address[] memory);

    function setDefaultSendLibrary(uint32 _eid, address _newLib) external;

    function defaultSendLibrary(uint32 _eid) external view returns (address);

    function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _gracePeriod) external;

    function defaultReceiveLibrary(uint32 _eid) external view returns (address);

    function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external;

    function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry);

    function isSupportedEid(uint32 _eid) external view returns (bool);

    function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool);

    /// ------------------- OApp interfaces -------------------
    function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external;

    function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);

    function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool);

    function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external;

    function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault);

    function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _expiry) external;

    function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry);

    function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;

    function getConfig(
        address _oapp,
        address _lib,
        uint32 _eid,
        uint32 _configType
    ) external view returns (bytes memory config);
}
          

lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}
          

lib/openzeppelin-contracts/contracts/utils/Strings.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

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

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

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

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

node_modules/@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/interfaces/IOAppReceiver.sol

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

import { ILayerZeroReceiver, Origin } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol";

interface IOAppReceiver is ILayerZeroReceiver {
    /**
     * @notice Indicates whether an address is an approved composeMsg sender to the Endpoint.
     * @param _origin The origin information containing the source endpoint and sender address.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address on the src chain.
     *  - nonce: The nonce of the message.
     * @param _message The lzReceive payload.
     * @param _sender The sender address.
     * @return isSender Is a valid sender.
     *
     * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.
     * @dev The default sender IS the OAppReceiver implementer.
     */
    function isComposeMsgSender(
        Origin calldata _origin,
        bytes calldata _message,
        address _sender
    ) external view returns (bool isSender);
}
          

lib/solidity-bits/contracts/Popcount.sol

// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits

 */

pragma solidity ^0.8.0;

library Popcount {
    uint256 private constant m1 = 0x5555555555555555555555555555555555555555555555555555555555555555;
    uint256 private constant m2 = 0x3333333333333333333333333333333333333333333333333333333333333333;
    uint256 private constant m4 = 0x0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f0f;
    uint256 private constant h01 = 0x0101010101010101010101010101010101010101010101010101010101010101;

    function popcount256A(uint256 x) internal pure returns (uint256 count) {
        unchecked{
            for (count=0; x!=0; count++)
                x &= x - 1;
        }
    }

    function popcount256B(uint256 x) internal pure returns (uint256) {
        if (x == type(uint256).max) {
            return 256;
        }
        unchecked {
            x -= (x >> 1) & m1;             //put count of each 2 bits into those 2 bits
            x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits 
            x = (x + (x >> 4)) & m4;        //put count of each 8 bits into those 8 bits 
            x = (x * h01) >> 248;  //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ... 
        }
        return x;
    }
}
          

lib/openzeppelin-contracts/contracts/interfaces/IERC2981.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

import "../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.
 *
 * _Available since v4.5._
 */
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);
}
          

lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol

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

pragma solidity ^0.8.0;

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

lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol

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

pragma solidity ^0.8.0;

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

lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}
          

lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/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;
    }
}
          

src/GenesisChampion.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.24;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

import {GenesisBaseV2} from "./abstracts/GenesisBaseV2.sol";
import {IGenesisChampion} from "./interfaces/IGenesisChampion.sol";
import {Errors} from "./librairies/Errors.sol";
import {MessagingFee, OApp, Origin} from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OApp.sol";
import {MessagingReceipt} from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppSender.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Context as ContextV5} from "@openzeppelin/contracts/utils/Context.sol";
import {Context as ContextV4} from "openzeppelinV4/utils/Context.sol";
import {Strings} from "openzeppelinV4/utils/Strings.sol";
import {ERC721Psi} from "src/ERC721Psi/ERC721Psi.sol";
import {GenesisChampionArgs as ConstructorArgs} from "src/types/GenesisChampionArgs.sol";

contract GenesisChampion is GenesisBaseV2, IGenesisChampion, OApp {

    using Strings for uint256;

    /// @notice LzSend is emitted when a token is bridged to another chain
    event LzSend(address to, uint256 id, uint32 toEid);

    /// @notice LzReceive is emitted when a token is bridged from another chain
    event LzReceive(address to, uint256 id, uint32 fromEid);

    // =============================================================
    //                   VARIABLES
    // =============================================================

    /// @inheritdoc IGenesisChampion
    uint256 public immutable defaultMaxCraftCount;

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

    /**
     * @dev Initializes the contract
     * @param args GenesisChampion constructor arguments
     */
    constructor(ConstructorArgs memory args)
        ERC721Psi(args.name, args.symbol)
        OApp(args.endpointL0, args.owner)
        Ownable(args.owner)
    {
        // Setup owner and DEFAULT_ADMIN_ROLE
        _setupRole(DEFAULT_ADMIN_ROLE, args.owner);
        // Setup MINTER_ROLE
        if (args.minter != address(0)) _grantRole(MINTER_ROLE, args.minter);
        if (args.crafter != address(0)) _grantRole(MINTER_ROLE, args.crafter);
        // Set royalties to a default 9% using ERC2981
        _setDefaultRoyalty(args.vault, 900);
        // Set baseURI, or call setBaseURI() later if empty arg
        baseURI = args.baseURI;
        // Set the default maximum craft count
        defaultMaxCraftCount = args.defaultMaxCraftCount;
    }

    // =============================================================
    //                   PUBLIC
    // =============================================================

    /**
     * @inheritdoc IGenesisChampion
     */
    function mint(address to, uint256 amount) external onlyRole(MINTER_ROLE) returns (uint256, uint256) {
        uint256 startNextTokenId = _nextTokenId();
        _safeMint(to, amount);
        return (startNextTokenId, _nextTokenId() - 1);
    }

    // =============================================================
    //                   ERC721
    // =============================================================

    /**
     * @inheritdoc ERC721Psi
     */
    function _startTokenId() internal pure override returns (uint256) {
        return 1;
    }

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

        return string(abi.encodePacked(_baseURI(), tokenId.toString(), ".json"));
    }

    // =============================================================
    //                   LAYER ZERO
    // =============================================================

    /**
     * @notice Sends a token from the source chain to a destination chain.
     * @param _dstEid The endpoint ID of the destination chain.
     * @param _dstTo The receiver of the token
     * @param _id The ID of the token
     * @param _options Additional options for message execution.
     * @dev Encodes the message as bytes and sends it using the `_lzSend` internal function.
     * @return receipt A `MessagingReceipt` struct containing details of the message sent.
     */
    function send(uint32 _dstEid, address _dstTo, uint256 _id, bytes calldata _options)
        external
        payable
        returns (MessagingReceipt memory receipt)
    {
        transferFrom(_dstTo, address(this), _id);
        bytes memory _payload = abi.encode(_dstTo, _id);
        receipt = _lzSend(_dstEid, _payload, _options, MessagingFee(msg.value, 0), payable(msg.sender));
        emit LzSend(_dstTo, _id, _dstEid);
    }
    
    /**
     * @notice Quotes the gas needed to pay for the full omnichain transaction in native gas or ZRO token.
     * @param _dstEid Destination chain's endpoint ID.
     * @param _dstTo The receiver of the token
     * @param _id The ID of the token
     * @param _options Message execution options (e.g., for sending gas to destination).
     * @param _payInLzToken Whether to return fee in ZRO token.
     * @return fee A `MessagingFee` struct containing the calculated gas fee in either the native token or ZRO token.
     */
    function quote(uint32 _dstEid, address _dstTo, uint256 _id, bytes memory _options, bool _payInLzToken)
        public
        view
        returns (MessagingFee memory fee)
    {
        bytes memory payload = abi.encode(_dstTo, _id);
        fee = _quote(_dstEid, payload, _options, _payInLzToken);
    }

    /**
     * @dev Internal function override to handle incoming messages from another chain.
     * @dev _origin A struct containing information about the message sender.
     * @dev _guid A unique global packet identifier for the message.
     * @param payload The encoded message payload being received.
     *
     * @dev The following params are unused in the current implementation of the OApp.
     * @dev _executor The address of the Executor responsible for processing the message.
     * @dev _extraData Arbitrary data appended by the Executor to the message.
     *
     * Decodes the received payload and processes it as per the business logic defined in the function.
     */
    function _lzReceive(
        Origin calldata _origin,
        bytes32, /*_guid*/
        bytes calldata payload,
        address, /*_executor*/
        bytes calldata /*_extraData*/
    ) internal override {
        (address to, uint256 id) = abi.decode(payload, (address, uint256));
        require(ownerOf(id) == address(this), "contract doesn't own the token");
        _transfer(address(this), to, id);
        emit LzReceive(to, id, _origin.srcEid);
    }

    // =============================================================
    //                   CONTEXT
    // =============================================================

    function _msgSender() internal view virtual override (ContextV5, ContextV4) returns (address) {
        return ContextV5._msgSender();
    }

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

}
          

node_modules/@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppSender.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { MessagingParams, MessagingFee, MessagingReceipt } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";
import { OAppCore } from "./OAppCore.sol";

/**
 * @title OAppSender
 * @dev Abstract contract implementing the OAppSender functionality for sending messages to a LayerZero endpoint.
 */
abstract contract OAppSender is OAppCore {
    using SafeERC20 for IERC20;

    // Custom error messages
    error NotEnoughNative(uint256 msgValue);
    error LzTokenUnavailable();

    // @dev The version of the OAppSender implementation.
    // @dev Version is bumped when changes are made to this contract.
    uint64 internal constant SENDER_VERSION = 1;

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     *
     * @dev Providing 0 as the default for OAppReceiver version. Indicates that the OAppReceiver is not implemented.
     * ie. this is a SEND only OApp.
     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions
     */
    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {
        return (SENDER_VERSION, 0);
    }

    /**
     * @dev Internal function to interact with the LayerZero EndpointV2.quote() for fee calculation.
     * @param _dstEid The destination endpoint ID.
     * @param _message The message payload.
     * @param _options Additional options for the message.
     * @param _payInLzToken Flag indicating whether to pay the fee in LZ tokens.
     * @return fee The calculated MessagingFee for the message.
     *      - nativeFee: The native fee for the message.
     *      - lzTokenFee: The LZ token fee for the message.
     */
    function _quote(
        uint32 _dstEid,
        bytes memory _message,
        bytes memory _options,
        bool _payInLzToken
    ) internal view virtual returns (MessagingFee memory fee) {
        return
            endpoint.quote(
                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _payInLzToken),
                address(this)
            );
    }

    /**
     * @dev Internal function to interact with the LayerZero EndpointV2.send() for sending a message.
     * @param _dstEid The destination endpoint ID.
     * @param _message The message payload.
     * @param _options Additional options for the message.
     * @param _fee The calculated LayerZero fee for the message.
     *      - nativeFee: The native fee.
     *      - lzTokenFee: The lzToken fee.
     * @param _refundAddress The address to receive any excess fee values sent to the endpoint.
     * @return receipt The receipt for the sent message.
     *      - guid: The unique identifier for the sent message.
     *      - nonce: The nonce of the sent message.
     *      - fee: The LayerZero fee incurred for the message.
     */
    function _lzSend(
        uint32 _dstEid,
        bytes memory _message,
        bytes memory _options,
        MessagingFee memory _fee,
        address _refundAddress
    ) internal virtual returns (MessagingReceipt memory receipt) {
        // @dev Push corresponding fees to the endpoint, any excess is sent back to the _refundAddress from the endpoint.
        uint256 messageValue = _payNative(_fee.nativeFee);
        if (_fee.lzTokenFee > 0) _payLzToken(_fee.lzTokenFee);

        return
            // solhint-disable-next-line check-send-result
            endpoint.send{ value: messageValue }(
                MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _fee.lzTokenFee > 0),
                _refundAddress
            );
    }

    /**
     * @dev Internal function to pay the native fee associated with the message.
     * @param _nativeFee The native fee to be paid.
     * @return nativeFee The amount of native currency paid.
     *
     * @dev If the OApp needs to initiate MULTIPLE LayerZero messages in a single transaction,
     * this will need to be overridden because msg.value would contain multiple lzFees.
     * @dev Should be overridden in the event the LayerZero endpoint requires a different native currency.
     * @dev Some EVMs use an ERC20 as a method for paying transactions/gasFees.
     * @dev The endpoint is EITHER/OR, ie. it will NOT support both types of native payment at a time.
     */
    function _payNative(uint256 _nativeFee) internal virtual returns (uint256 nativeFee) {
        if (msg.value != _nativeFee) revert NotEnoughNative(msg.value);
        return _nativeFee;
    }

    /**
     * @dev Internal function to pay the LZ token fee associated with the message.
     * @param _lzTokenFee The LZ token fee to be paid.
     *
     * @dev If the caller is trying to pay in the specified lzToken, then the lzTokenFee is passed to the endpoint.
     * @dev Any excess sent, is passed back to the specified _refundAddress in the _lzSend().
     */
    function _payLzToken(uint256 _lzTokenFee) internal virtual {
        // @dev Cannot cache the token because it is not immutable in the endpoint.
        address lzToken = endpoint.lzToken();
        if (lzToken == address(0)) revert LzTokenUnavailable();

        // Pay LZ token fee by sending tokens to the endpoint.
        IERC20(lzToken).safeTransferFrom(msg.sender, address(endpoint), _lzTokenFee);
    }
}
          

src/ERC721Psi/ERC721Psi.sol

// SPDX-License-Identifier: MIT
/**
 * ______ _____   _____ ______ ___  __ _  _  _
 *  |  ____|  __ \ / ____|____  |__ \/_ | || || |
 *  | |__  | |__) | |        / /   ) || | \| |/ |
 *  |  __| |  _  /| |       / /   / / | |\_   _/
 *  | |____| | \ \| |____  / /   / /_ | |  | |
 *  |______|_|  \_\\_____|/_/   |____||_|  |_|
 *
 *  - github: https://github.com/estarriolvetch/ERC721Psi
 *  - npm: https://www.npmjs.com/package/erc721psi
 */
pragma solidity ^0.8.0;

import "openzeppelinV4/token/ERC721/IERC721.sol";
import "openzeppelinV4/token/ERC721/IERC721Receiver.sol";
import "openzeppelinV4/token/ERC721/extensions/IERC721Metadata.sol";
import "openzeppelinV4/utils/Address.sol";
import "openzeppelinV4/utils/Context.sol";
import "openzeppelinV4/utils/StorageSlot.sol";
import "openzeppelinV4/utils/Strings.sol";
import "openzeppelinV4/utils/introspection/ERC165.sol";
import "solidity-bits/contracts/BitMaps.sol";

contract ERC721Psi is Context, ERC165, IERC721, IERC721Metadata {

    using Address for address;
    using Strings for uint256;
    using BitMaps for BitMaps.BitMap;

    BitMaps.BitMap private _batchHead;

    string private _name;
    string private _symbol;

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

    mapping(uint256 => address) private _tokenApprovals;
    mapping(address => mapping(address => bool)) private _operatorApprovals;

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

    /**
     * @dev Returns the starting token ID.
     * To change the starting token ID, please override this function.
     */
    function _startTokenId() internal pure virtual returns (uint256) {
        // It will become modifiable in the future versions
        return 0;
    }

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

    /**
     * @dev Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view virtual returns (uint256) {
        return _currentIndex - _startTokenId();
    }

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

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

        uint256 count;
        for (uint256 i = _startTokenId(); i < _nextTokenId(); ++i) {
            if (_exists(i)) if (owner == ownerOf(i)) ++count;
        }
        return count;
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        (address owner,) = _ownerAndBatchHeadOf(tokenId);
        return owner;
    }

    function _ownerAndBatchHeadOf(uint256 tokenId) internal view returns (address owner, uint256 tokenIdBatchHead) {
        require(_exists(tokenId), "ERC721Psi: owner query for nonexistent token");
        tokenIdBatchHead = _getBatchHead(tokenId);
        owner = _owners[tokenIdBatchHead];
    }

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721Psi: approve to caller");

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
        _transfer(from, to, tokenId);
        require(
            _checkOnERC721Received(from, to, tokenId, 1, _data), "ERC721Psi: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return tokenId < _nextTokenId() && _startTokenId() <= tokenId;
    }

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

    /**
     * @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.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 quantity) internal virtual {
        _safeMint(to, quantity, "");
    }

    function _safeMint(address to, uint256 quantity, bytes memory _data) internal virtual {
        uint256 nextTokenId = _nextTokenId();
        _mint(to, quantity);
        require(
            _checkOnERC721Received(address(0), to, nextTokenId, quantity, _data),
            "ERC721Psi: transfer to non ERC721Receiver implementer"
        );
    }

    function _mint(address to, uint256 quantity) internal virtual {
        uint256 nextTokenId = _nextTokenId();

        require(quantity > 0, "ERC721Psi: quantity must be greater 0");
        require(to != address(0), "ERC721Psi: mint to the zero address");

        _beforeTokenTransfers(address(0), to, nextTokenId, quantity);
        _currentIndex += quantity;
        _owners[nextTokenId] = to;
        _batchHead.set(nextTokenId);
        _afterTokenTransfers(address(0), to, nextTokenId, quantity);

        // Emit events
        for (uint256 tokenId = nextTokenId; tokenId < nextTokenId + quantity; tokenId++) {
            emit Transfer(address(0), to, tokenId);
        }
    }

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

        require(owner == from, "ERC721Psi: transfer of token that is not own");
        require(to != address(0), "ERC721Psi: transfer to the zero address");

        _beforeTokenTransfers(from, to, tokenId, 1);

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

        uint256 subsequentTokenId = tokenId + 1;

        if (!_batchHead.get(subsequentTokenId) && subsequentTokenId < _nextTokenId()) {
            _owners[subsequentTokenId] = from;
            _batchHead.set(subsequentTokenId);
        }

        _owners[tokenId] = to;
        if (tokenId != tokenIdBatchHead) _batchHead.set(tokenId);

        emit Transfer(from, to, tokenId);

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

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

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

    function _getBatchHead(uint256 tokenId) internal view returns (uint256 tokenIdBatchHead) {
        tokenIdBatchHead = _batchHead.scanForward(tokenId);
    }

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

    /**
     * @dev Returns an array of token IDs owned by `owner`.
     *
     * This function scans the ownership mapping and is O(`totalSupply`) in complexity.
     * It is meant to be called off-chain.
     *
     * This function is compatiable with ERC721AQueryable.
     */
    function tokensOfOwner(address owner) external view virtual returns (uint256[] memory) {
        unchecked {
            uint256 tokenIdsIdx;
            uint256 tokenIdsLength = balanceOf(owner);
            uint256[] memory tokenIds = new uint256[](tokenIdsLength);
            for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) {
                if (_exists(i)) if (ownerOf(i) == owner) tokenIds[tokenIdsIdx++] = i;
            }
            return tokenIds;
        }
    }

    /**
     * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting.
     *
     * 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`.
     */
    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.
     *
     * 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` and `to` are never both zero.
     */
    function _afterTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity) internal virtual {}

}
          

src/interfaces/IGenesisBase.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.24;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

import {MintData} from "../types/MintData.sol";

/**
 * @title IGenesisBase
 *
 * @notice Interface for the GenesisBase contract used for minting and
 * setting a metadata CID on top of ERC721Psi, EIP712, Ownable, AccessControl
 */
interface IGenesisBase {

    /**
     * @notice can only be called once if baseURI isn't set
     * @notice can only be called by the contract owner
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     * @param _uri Content Identifier of the IPFS folder containing metadata files
     */
    function setBaseURI(string calldata _uri) external;

    /**
     * @notice update the default royalty informations as per ERC2981
     * @notice can only be called by the contract owner
     * @dev emits UpdateDefaultRoyalty(receiver, feeNumerator)
     * @param receiver address of the new vault receiving royalty fees
     * @param feeNumerator percentage of royalties to apply
     */
    function updateDefaultRoyalty(address receiver, uint96 feeNumerator) external;

}
          

lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

lib/openzeppelin-contracts/contracts/access/IAccessControl.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

src/interfaces/IGenesisChampionFactory.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.24;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

import {GenesisChampionArgs} from "src/types/GenesisChampionArgs.sol";

interface IGenesisChampionFactory {

    /**
     * @notice deploy a new GenesisChampion contract and register it in the deployedVersions array
     * @param _args constructor arguments for GenesisChampion
     */
    function deploy(GenesisChampionArgs calldata _args) external returns (address, uint256);

    /**
     * @notice return the last deployed contract
     */
    function lastDeployment() external returns (address);

    /**
     * @notice return the last deployed version
     */
    function lastVersion() external returns (uint256);

    /**
     * @notice getter for the deployedVersions mapping
     * @param collection address of the token
     */
    function deployedVersions(address collection) external view returns (uint256);
}
          

lib/openzeppelin-contracts/contracts/utils/Context.sol

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

pragma solidity ^0.8.0;

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

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

lib/openzeppelin-contracts/contracts/token/common/ERC2981.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol)

pragma solidity ^0.8.0;

import "../../interfaces/IERC2981.sol";
import "../../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.
 *
 * _Available since v4.5._
 */
abstract contract ERC2981 is IERC2981, ERC165 {
    struct RoyaltyInfo {
        address receiver;
        uint96 royaltyFraction;
    }

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

    /**
     * @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 override 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 {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: invalid receiver");

        _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 {
        require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice");
        require(receiver != address(0), "ERC2981: Invalid parameters");

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

lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

node_modules/@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/interfaces/IOAppCore.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { ILayerZeroEndpointV2 } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";

/**
 * @title IOAppCore
 */
interface IOAppCore {
    // Custom error messages
    error OnlyPeer(uint32 eid, bytes32 sender);
    error NoPeer(uint32 eid);
    error InvalidEndpointCall();
    error InvalidDelegate();

    // Event emitted when a peer (OApp) is set for a corresponding endpoint
    event PeerSet(uint32 eid, bytes32 peer);

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     */
    function oAppVersion() external view returns (uint64 senderVersion, uint64 receiverVersion);

    /**
     * @notice Retrieves the LayerZero endpoint associated with the OApp.
     * @return iEndpoint The LayerZero endpoint as an interface.
     */
    function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint);

    /**
     * @notice Retrieves the peer (OApp) associated with a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @return peer The peer address (OApp instance) associated with the corresponding endpoint.
     */
    function peers(uint32 _eid) external view returns (bytes32 peer);

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     */
    function setPeer(uint32 _eid, bytes32 _peer) external;

    /**
     * @notice Sets the delegate address for the OApp Core.
     * @param _delegate The address of the delegate to be set.
     */
    function setDelegate(address _delegate) external;
}
          

node_modules/@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppReceiver.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { IOAppReceiver, Origin } from "./interfaces/IOAppReceiver.sol";
import { OAppCore } from "./OAppCore.sol";

/**
 * @title OAppReceiver
 * @dev Abstract contract implementing the ILayerZeroReceiver interface and extending OAppCore for OApp receivers.
 */
abstract contract OAppReceiver is IOAppReceiver, OAppCore {
    // Custom error message for when the caller is not the registered endpoint/
    error OnlyEndpoint(address addr);

    // @dev The version of the OAppReceiver implementation.
    // @dev Version is bumped when changes are made to this contract.
    uint64 internal constant RECEIVER_VERSION = 2;

    /**
     * @notice Retrieves the OApp version information.
     * @return senderVersion The version of the OAppSender.sol contract.
     * @return receiverVersion The version of the OAppReceiver.sol contract.
     *
     * @dev Providing 0 as the default for OAppSender version. Indicates that the OAppSender is not implemented.
     * ie. this is a RECEIVE only OApp.
     * @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions.
     */
    function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {
        return (0, RECEIVER_VERSION);
    }

    /**
     * @notice Indicates whether an address is an approved composeMsg sender to the Endpoint.
     * @dev _origin The origin information containing the source endpoint and sender address.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address on the src chain.
     *  - nonce: The nonce of the message.
     * @dev _message The lzReceive payload.
     * @param _sender The sender address.
     * @return isSender Is a valid sender.
     *
     * @dev Applications can optionally choose to implement separate composeMsg senders that are NOT the bridging layer.
     * @dev The default sender IS the OAppReceiver implementer.
     */
    function isComposeMsgSender(
        Origin calldata /*_origin*/,
        bytes calldata /*_message*/,
        address _sender
    ) public view virtual returns (bool) {
        return _sender == address(this);
    }

    /**
     * @notice Checks if the path initialization is allowed based on the provided origin.
     * @param origin The origin information containing the source endpoint and sender address.
     * @return Whether the path has been initialized.
     *
     * @dev This indicates to the endpoint that the OApp has enabled msgs for this particular path to be received.
     * @dev This defaults to assuming if a peer has been set, its initialized.
     * Can be overridden by the OApp if there is other logic to determine this.
     */
    function allowInitializePath(Origin calldata origin) public view virtual returns (bool) {
        return peers[origin.srcEid] == origin.sender;
    }

    /**
     * @notice Retrieves the next nonce for a given source endpoint and sender address.
     * @dev _srcEid The source endpoint ID.
     * @dev _sender The sender address.
     * @return nonce The next nonce.
     *
     * @dev The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.
     * @dev Is required by the off-chain executor to determine the OApp expects msg execution is ordered.
     * @dev This is also enforced by the OApp.
     * @dev By default this is NOT enabled. ie. nextNonce is hardcoded to return 0.
     */
    function nextNonce(uint32 /*_srcEid*/, bytes32 /*_sender*/) public view virtual returns (uint64 nonce) {
        return 0;
    }

    /**
     * @dev Entry point for receiving messages or packets from the endpoint.
     * @param _origin The origin information containing the source endpoint and sender address.
     *  - srcEid: The source chain endpoint ID.
     *  - sender: The sender address on the src chain.
     *  - nonce: The nonce of the message.
     * @param _guid The unique identifier for the received LayerZero message.
     * @param _message The payload of the received message.
     * @param _executor The address of the executor for the received message.
     * @param _extraData Additional arbitrary data provided by the corresponding executor.
     *
     * @dev Entry point for receiving msg/packet from the LayerZero endpoint.
     */
    function lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) public payable virtual {
        // Ensures that only the endpoint can attempt to lzReceive() messages to this OApp.
        if (address(endpoint) != msg.sender) revert OnlyEndpoint(msg.sender);

        // Ensure that the sender matches the expected peer for the source endpoint.
        if (_getPeerOrRevert(_origin.srcEid) != _origin.sender) revert OnlyPeer(_origin.srcEid, _origin.sender);

        // Call the internal OApp implementation of lzReceive.
        _lzReceive(_origin, _guid, _message, _executor, _extraData);
    }

    /**
     * @dev Internal function to implement lzReceive logic without needing to copy the basic parameter validation.
     */
    function _lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) internal virtual;
}
          

src/librairies/Errors.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.24;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

/**
 * @title Errors
 *
 * @notice Library contains all the custom errors used to revert in Genesis contracts
 */
library Errors {

    /**
     * @notice user has already minted
     */
    error AlreadyMinted();

    /**
     * @notice signature is invalid
     */
    error InvalidSignature();

    /**
     * @notice signature is being used too early
     */
    error SignatureValidityStart();

    /**
     * @notice signature isn't valid anymore
     */
    error SignatureValidityEnd();

    /**
     * @notice signature was created for another chain_id
     */
    error WrongChainID();

    /**
     * @notice baseURI was already set once
     */
    error BaseURIAlreadyInitialized();

    /**
     * @notice token does not exist
     */
    error ERC721UriNonExistent();

    /**
     * @notice MintData.mint_amount cannot be 0
     */
    error InvalidMintAmount();

    /**
     * @notice the token maximum supply is reached
     */
    error MaxSupplyReached();

    /**
     * Chainlink VRF request was already called
     */
    error RequestAlreadyInitialized();

    /**
     * GenesisPFP contract does not own any Link tokens
     */
    error EmptyLinkBalance();

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

    /**
     * Champion used all its craft
     */
    error MaxCraftCount(address collection, uint256 tokenId, uint256 maxCraftCount);

    /**
     * Zero address was passed in function parameter
     */
    error ZeroAddress();

    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev Parents are the same
     */
    error CraftWithSameParents(address collection, uint256 parentA);

    /**
     * @dev User does not own the token
     */
    error CallerNotOwner(address collection, uint256 parent);

    /**
     * @dev Collection wasn't deployed by the factory
     */
    error CollectionUnknown(address collection);

    /**
     * @dev Payment value `given` was provided in currency `token` doesn't match the required amount `want`
     * @dev token is address(0) in case of OAS or soft currency
     */
    error PaymentValue(address token, uint256 given, uint256 want);

    /**
     * @dev Transfering amount{`value`} of (OAS|ERC20){`token`} to address `vault` failed
     */
    error TransferCraftFees(address token, uint256 value, address vault);

    /**
     * @dev Craft with soft currency but payment value was passed
     */
    error WantSoftGotToken();

    /**
     * @dev Minter supply is already set for the collection
     */
    error SupplyUnregistered(address collection);

    /**
     * @dev Checks the Champion's craft count after executing the craft
     */
    error UnexpectedCraftCount(address collection, uint256 id);
    
    /**
     * @dev Duplicate season setup
     */
    error SeasonAlreadyExist();

    /**
     * @dev Season doesn't exist
     */
    error SeasonUnknown();

    /**
     * @dev Claiming period for the current season is closed
     */
    error ClaimingPeriodClosed();

    /**
     * @dev Craft capacities are locked for a certain time for a Champion
     */
    error ParentCraftLock();

    /**
     * @dev SeasonReward.supply cannot be 0
     */
    error ZeroSupply();

    /**
     * @dev Wrong SeasonReward.claimStart parameter
     */
    error RewardsClaimStart();

    /**
     * @dev Wrong SeasonReward.claimStart parameter
     */
    error RewardsClaimEnd();

    /**
     * @dev Token is already bridged
     */
    error LockedToken(uint256 id);
}
          

lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/utils/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();
        }
    }
}
          

lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/access/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);
    }
}
          

src/ERC721Psi/extension/ERC721PsiAddressData.sol

// SPDX-License-Identifier: MIT
/**
 * ______ _____   _____ ______ ___  __ _  _  _
 *  |  ____|  __ \ / ____|____  |__ \/_ | || || |
 *  | |__  | |__) | |        / /   ) || | \| |/ |
 *  |  __| |  _  /| |       / /   / / | |\_   _/
 *  | |____| | \ \| |____  / /   / /_ | |  | |
 *  |______|_|  \_\\_____|/_/   |____||_|  |_|
 */
pragma solidity ^0.8.0;

import "../ERC721Psi.sol";
import "solidity-bits/contracts/BitMaps.sol";

/**
 * @dev This extension follows the AddressData format of ERC721A, so
 *     it can be a dropped-in replacement for the contract that requires AddressData
 */
abstract contract ERC721PsiAddressData is ERC721Psi {

    // Mapping owner address to address data
    mapping(address => AddressData) _addressData;

    // Compiler will pack this into a single 256bit word.
    struct AddressData {
        // Realistically, 2**64-1 is more than enough.
        uint64 balance;
        // Keeps track of mint count with minimal overhead for tokenomics.
        uint64 numberMinted;
        // Keeps track of burn count with minimal overhead for tokenomics.
        uint64 numberBurned;
        // For miscellaneous variable(s) pertaining to the address
        // (e.g. number of whitelist mint slots used).
        // If there are multiple variables, please pack them into a uint64.
        uint64 aux;
    }

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

    /**
     * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes
     * minting.
     *
     * 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` and `to` are never both zero.
     */
    function _afterTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity)
        internal
        virtual
        override
    {
        require(quantity < 2 ** 64);
        uint64 _quantity = uint64(quantity);

        if (from != address(0)) {
            _addressData[from].balance -= _quantity;
        } else {
            // Mint
            _addressData[to].numberMinted += _quantity;
        }

        if (to != address(0)) {
            _addressData[to].balance += _quantity;
        } else {
            // Burn
            _addressData[from].numberBurned += _quantity;
        }
        super._afterTokenTransfers(from, to, startTokenId, quantity);
    }

}
          

node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import { Origin } from "./ILayerZeroEndpointV2.sol";

interface ILayerZeroReceiver {
    function allowInitializePath(Origin calldata _origin) external view returns (bool);

    function nextNonce(uint32 _eid, bytes32 _sender) external view returns (uint64);

    function lzReceive(
        Origin calldata _origin,
        bytes32 _guid,
        bytes calldata _message,
        address _executor,
        bytes calldata _extraData
    ) external payable;
}
          

node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingComposer.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingComposer {
    event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message);
    event ComposeDelivered(address from, address to, bytes32 guid, uint16 index);
    event LzComposeAlert(
        address indexed from,
        address indexed to,
        address indexed executor,
        bytes32 guid,
        uint16 index,
        uint256 gas,
        uint256 value,
        bytes message,
        bytes extraData,
        bytes reason
    );

    function composeQueue(
        address _from,
        address _to,
        bytes32 _guid,
        uint16 _index
    ) external view returns (bytes32 messageHash);

    function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external;

    function lzCompose(
        address _from,
        address _to,
        bytes32 _guid,
        uint16 _index,
        bytes calldata _message,
        bytes calldata _extraData
    ) external payable;
}
          

src/abstracts/GenesisBaseV2.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.24;

//  **     **  **       **                    ****   **
// /**    /** /**      //                    /**/   /**
// /**    /** /**       **  ******  ******  ****** ******
// /**    /** /******  /** **////  **////**///**/ ///**/
// /**    /** /**///** /**//***** /**   /**  /**    /**
// /**    /** /**  /** /** /////**/**   /**  /**    /**
// //*******  /******  /** ****** //******   /**    //**
// ///////    /////    // //////   //////    //      //

import {AccessControl} from "openzeppelinV4/access/AccessControl.sol";
import {IERC721} from "openzeppelinV4/token/ERC721/IERC721.sol";
import {ERC2981} from "openzeppelinV4/token/common/ERC2981.sol";
import {ERC721Psi} from "src/ERC721Psi/ERC721Psi.sol";
import {ERC721PsiAddressData} from "src/ERC721Psi/extension/ERC721PsiAddressData.sol";
import {ERC721PsiBurnable} from "src/ERC721Psi/extension/ERC721PsiBurnable.sol";
import {IGenesisBase} from "src/interfaces/IGenesisBase.sol";
import {Errors} from "src/librairies/Errors.sol";

/**
 * @title GenesisBaseV2
 *
 * @dev GenesisBaseV2 implements ERC721Psi as a base for GenesisChampion
 * for GenesisChampion
 */
abstract contract GenesisBaseV2 is IGenesisBase, ERC721PsiAddressData, ERC721PsiBurnable, ERC2981, AccessControl {

    // =============================================================
    //                   EVENTS
    // =============================================================

    /// @notice UpdateDefaultRoyalty is emitted when calling `updateDefaultRoyalty`
    event UpdateDefaultRoyalty(address receiver, uint96 feeNumerator);

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

    /// @notice Minter role used for AccessControl
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

    // =============================================================
    //                   VARIABLES
    // =============================================================

    /// @notice baseURI for computing tokenURI
    string public baseURI;

    // =============================================================
    //                   EXTERNAL
    // =============================================================

    /**
     * @inheritdoc IGenesisBase
     */
    function setBaseURI(string calldata baseURI_) external override onlyRole(DEFAULT_ADMIN_ROLE) {
        if (bytes(baseURI).length > 0) revert Errors.BaseURIAlreadyInitialized();
        baseURI = baseURI_;
    }

    /**
     * @inheritdoc IGenesisBase
     */
    function updateDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyRole(DEFAULT_ADMIN_ROLE) {
        _setDefaultRoyalty(receiver, feeNumerator);
        emit UpdateDefaultRoyalty(receiver, feeNumerator);
    }

    // =============================================================
    //                   PUBLIC
    // =============================================================

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override (ERC721Psi, ERC2981, AccessControl)
        returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }

    // =============================================================
    //                   INTERNAL
    // =============================================================

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

    function _afterTokenTransfers(address from, address to, uint256 startTokenId, uint256 quantity)
        internal
        virtual
        override(ERC721Psi, ERC721PsiAddressData)
    {
        return ERC721PsiAddressData._afterTokenTransfers(from, to, startTokenId, quantity);
    }

    function _exists(uint256 tokenId) internal view override(ERC721Psi, ERC721PsiBurnable) virtual returns (bool){
        return ERC721PsiBurnable._exists(tokenId);
    }

    function balanceOf(address owner) public view virtual override(ERC721Psi, ERC721PsiAddressData) returns (uint256) {
        return ERC721PsiAddressData.balanceOf(owner);
    }

    function totalSupply() public view virtual override(ERC721Psi, ERC721PsiBurnable) returns (uint256) {
        return ERC721PsiBurnable.totalSupply();
    }

}
          

node_modules/@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppCore.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { IOAppCore, ILayerZeroEndpointV2 } from "./interfaces/IOAppCore.sol";

/**
 * @title OAppCore
 * @dev Abstract contract implementing the IOAppCore interface with basic OApp configurations.
 */
abstract contract OAppCore is IOAppCore, Ownable {
    // The LayerZero endpoint associated with the given OApp
    ILayerZeroEndpointV2 public immutable endpoint;

    // Mapping to store peers associated with corresponding endpoints
    mapping(uint32 eid => bytes32 peer) public peers;

    /**
     * @dev Constructor to initialize the OAppCore with the provided endpoint and delegate.
     * @param _endpoint The address of the LOCAL Layer Zero endpoint.
     * @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
     *
     * @dev The delegate typically should be set as the owner of the contract.
     */
    constructor(address _endpoint, address _delegate) {
        endpoint = ILayerZeroEndpointV2(_endpoint);

        if (_delegate == address(0)) revert InvalidDelegate();
        endpoint.setDelegate(_delegate);
    }

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.
     * @dev Set this to bytes32(0) to remove the peer address.
     * @dev Peer is a bytes32 to accommodate non-evm chains.
     */
    function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner {
        _setPeer(_eid, _peer);
    }

    /**
     * @notice Sets the peer address (OApp instance) for a corresponding endpoint.
     * @param _eid The endpoint ID.
     * @param _peer The address of the peer to be associated with the corresponding endpoint.
     *
     * @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.
     * @dev Set this to bytes32(0) to remove the peer address.
     * @dev Peer is a bytes32 to accommodate non-evm chains.
     */
    function _setPeer(uint32 _eid, bytes32 _peer) internal virtual {
        peers[_eid] = _peer;
        emit PeerSet(_eid, _peer);
    }

    /**
     * @notice Internal function to get the peer address associated with a specific endpoint; reverts if NOT set.
     * ie. the peer is set to bytes32(0).
     * @param _eid The endpoint ID.
     * @return peer The address of the peer associated with the specified endpoint.
     */
    function _getPeerOrRevert(uint32 _eid) internal view virtual returns (bytes32) {
        bytes32 peer = peers[_eid];
        if (peer == bytes32(0)) revert NoPeer(_eid);
        return peer;
    }

    /**
     * @notice Sets the delegate address for the OApp.
     * @param _delegate The address of the delegate to be set.
     *
     * @dev Only the owner/admin of the OApp can call this function.
     * @dev Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.
     */
    function setDelegate(address _delegate) public onlyOwner {
        endpoint.setDelegate(_delegate);
    }
}
          

node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingChannel.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingChannel {
    event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce);
    event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);
    event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);

    function eid() external view returns (uint32);

    // this is an emergency function if a message cannot be verified for some reasons
    // required to provide _nextNonce to avoid race condition
    function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external;

    function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;

    function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;

    function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32);

    function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);

    function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64);

    function inboundPayloadHash(
        address _receiver,
        uint32 _srcEid,
        bytes32 _sender,
        uint64 _nonce
    ) external view returns (bytes32);

    function lazyInboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);
}
          

lib/solidity-bits/contracts/BitMaps.sol

// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits

 */
pragma solidity ^0.8.0;

import "./BitScan.sol";
import "./Popcount.sol";

/**
 * @dev This Library is a modified version of Openzeppelin's BitMaps library with extra features.
 *
 * 1. Functions of finding the index of the closest set bit from a given index are added.
 *    The indexing of each bucket is modifed to count from the MSB to the LSB instead of from the LSB to the MSB.
 *    The modification of indexing makes finding the closest previous set bit more efficient in gas usage.
 * 2. Setting and unsetting the bitmap consecutively.
 * 3. Accounting number of set bits within a given range.   
 *
*/

/**
 * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential.
 * Largelly inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor].
 */

library BitMaps {
    using BitScan for uint256;
    uint256 private constant MASK_INDEX_ZERO = (1 << 255);
    uint256 private constant MASK_FULL = type(uint256).max;

    struct BitMap {
        mapping(uint256 => uint256) _data;
    }

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

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

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

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


    /**
     * @dev Consecutively sets `amount` of bits starting from the bit at `startIndex`.
     */    
    function setBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

        unchecked {
            if(bucketStartIndex + amount < 256) {
                bitmap._data[bucket] |= MASK_FULL << (256 - amount) >> bucketStartIndex;
            } else {
                bitmap._data[bucket] |= MASK_FULL >> bucketStartIndex;
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    bitmap._data[bucket] = MASK_FULL;
                    amount -= 256;
                    bucket++;
                }

                bitmap._data[bucket] |= MASK_FULL << (256 - amount);
            }
        }
    }


    /**
     * @dev Consecutively unsets `amount` of bits starting from the bit at `startIndex`.
     */    
    function unsetBatch(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

        unchecked {
            if(bucketStartIndex + amount < 256) {
                bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount) >> bucketStartIndex);
            } else {
                bitmap._data[bucket] &= ~(MASK_FULL >> bucketStartIndex);
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    bitmap._data[bucket] = 0;
                    amount -= 256;
                    bucket++;
                }

                bitmap._data[bucket] &= ~(MASK_FULL << (256 - amount));
            }
        }
    }

    /**
     * @dev Returns number of set bits within a range.
     */
    function popcountA(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal view returns(uint256 count) {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

        unchecked {
            if(bucketStartIndex + amount < 256) {
                count +=  Popcount.popcount256A(
                    bitmap._data[bucket] & (MASK_FULL << (256 - amount) >> bucketStartIndex)
                );
            } else {
                count += Popcount.popcount256A(
                    bitmap._data[bucket] & (MASK_FULL >> bucketStartIndex)
                );
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    count += Popcount.popcount256A(bitmap._data[bucket]);
                    amount -= 256;
                    bucket++;
                }
                count += Popcount.popcount256A(
                    bitmap._data[bucket] & (MASK_FULL << (256 - amount))
                );
            }
        }
    }

    /**
     * @dev Returns number of set bits within a range.
     */
    function popcountB(BitMap storage bitmap, uint256 startIndex, uint256 amount) internal view returns(uint256 count) {
        uint256 bucket = startIndex >> 8;

        uint256 bucketStartIndex = (startIndex & 0xff);

        unchecked {
            if(bucketStartIndex + amount < 256) {
                count +=  Popcount.popcount256B(
                    bitmap._data[bucket] & (MASK_FULL << (256 - amount) >> bucketStartIndex)
                );
            } else {
                count += Popcount.popcount256B(
                    bitmap._data[bucket] & (MASK_FULL >> bucketStartIndex)
                );
                amount -= (256 - bucketStartIndex);
                bucket++;

                while(amount > 256) {
                    count += Popcount.popcount256B(bitmap._data[bucket]);
                    amount -= 256;
                    bucket++;
                }
                count += Popcount.popcount256B(
                    bitmap._data[bucket] & (MASK_FULL << (256 - amount))
                );
            }
        }
    }


    /**
     * @dev Find the closest index of the set bit before `index`.
     */
    function scanForward(BitMap storage bitmap, uint256 index) internal view returns (uint256 setBitIndex) {
        uint256 bucket = index >> 8;

        // index within the bucket
        uint256 bucketIndex = (index & 0xff);

        // load a bitboard from the bitmap.
        uint256 bb = bitmap._data[bucket];

        // offset the bitboard to scan from `bucketIndex`.
        bb = bb >> (0xff ^ bucketIndex); // bb >> (255 - bucketIndex)
        
        if(bb > 0) {
            unchecked {
                setBitIndex = (bucket << 8) | (bucketIndex -  bb.bitScanForward256());    
            }
        } else {
            while(true) {
                require(bucket > 0, "BitMaps: The set bit before the index doesn't exist.");
                unchecked {
                    bucket--;
                }
                // No offset. Always scan from the least significiant bit now.
                bb = bitmap._data[bucket];
                
                if(bb > 0) {
                    unchecked {
                        setBitIndex = (bucket << 8) | (255 -  bb.bitScanForward256());
                        break;
                    }
                } 
            }
        }
    }

    function getBucket(BitMap storage bitmap, uint256 bucket) internal view returns (uint256) {
        return bitmap._data[bucket];
    }
}
          

node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingContext.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

interface IMessagingContext {
    function isSendingMessage() external view returns (bool);

    function getSendContext() external view returns (uint32 dstEid, address sender);
}
          

lib/openzeppelin-contracts/contracts/utils/math/Math.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

src/ERC721Psi/extension/ERC721PsiBurnable.sol

// SPDX-License-Identifier: MIT
/**
  ______ _____   _____ ______ ___  __ _  _  _ 
 |  ____|  __ \ / ____|____  |__ \/_ | || || |
 | |__  | |__) | |        / /   ) || | \| |/ |
 |  __| |  _  /| |       / /   / / | |\_   _/ 
 | |____| | \ \| |____  / /   / /_ | |  | |   
 |______|_|  \_\\_____|/_/   |____||_|  |_|   
                                              
                                            
 */
pragma solidity ^0.8.0;

import "solidity-bits/contracts/BitMaps.sol";
import "../ERC721Psi.sol";


abstract contract ERC721PsiBurnable is ERC721Psi {
    using BitMaps for BitMaps.BitMap;
    BitMaps.BitMap private _burnedToken;

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address from = ownerOf(tokenId);
        _beforeTokenTransfers(from, address(0), tokenId, 1);
        _burnedToken.set(tokenId);
        
        emit Transfer(from, address(0), tokenId);

        _afterTokenTransfers(from, address(0), tokenId, 1);
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view override virtual returns (bool){
        if(_burnedToken.get(tokenId)) {
            return false;
        } 
        return super._exists(tokenId);
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalMinted() - _burned();
    }

    /**
     * @dev Returns number of token burned.
     */
    function _burned() internal view returns (uint256 burned){
        uint256 startBucket = _startTokenId() >> 8;
        uint256 lastBucket = (_nextTokenId() >> 8) + 1;

        for(uint256 i=startBucket; i < lastBucket; i++) {
            uint256 bucket = _burnedToken.getBucket(i);
            burned += _popcount(bucket);
        }
    }

    /**
     * @dev Returns number of set bits.
     */
    function _popcount(uint256 x) private pure returns (uint256 count) {
        unchecked{
            for (count=0; x!=0; count++)
                x &= x - 1;
        }
    }
}
          

node_modules/@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol

// SPDX-License-Identifier: MIT

pragma solidity >=0.8.0;

import { IMessageLibManager } from "./IMessageLibManager.sol";
import { IMessagingComposer } from "./IMessagingComposer.sol";
import { IMessagingChannel } from "./IMessagingChannel.sol";
import { IMessagingContext } from "./IMessagingContext.sol";

struct MessagingParams {
    uint32 dstEid;
    bytes32 receiver;
    bytes message;
    bytes options;
    bool payInLzToken;
}

struct MessagingReceipt {
    bytes32 guid;
    uint64 nonce;
    MessagingFee fee;
}

struct MessagingFee {
    uint256 nativeFee;
    uint256 lzTokenFee;
}

struct Origin {
    uint32 srcEid;
    bytes32 sender;
    uint64 nonce;
}

interface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext {
    event PacketSent(bytes encodedPayload, bytes options, address sendLibrary);

    event PacketVerified(Origin origin, address receiver, bytes32 payloadHash);

    event PacketDelivered(Origin origin, address receiver);

    event LzReceiveAlert(
        address indexed receiver,
        address indexed executor,
        Origin origin,
        bytes32 guid,
        uint256 gas,
        uint256 value,
        bytes message,
        bytes extraData,
        bytes reason
    );

    event LzTokenSet(address token);

    event DelegateSet(address sender, address delegate);

    function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory);

    function send(
        MessagingParams calldata _params,
        address _refundAddress
    ) external payable returns (MessagingReceipt memory);

    function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external;

    function verifiable(Origin calldata _origin, address _receiver) external view returns (bool);

    function initializable(Origin calldata _origin, address _receiver) external view returns (bool);

    function lzReceive(
        Origin calldata _origin,
        address _receiver,
        bytes32 _guid,
        bytes calldata _message,
        bytes calldata _extraData
    ) external payable;

    // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order
    function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external;

    function setLzToken(address _lzToken) external;

    function lzToken() external view returns (address);

    function nativeToken() external view returns (address);

    function setDelegate(address _delegate) external;
}
          

lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

lib/solidity-bits/contracts/BitScan.sol

// SPDX-License-Identifier: MIT
/**
   _____       ___     ___ __           ____  _ __      
  / ___/____  / (_)___/ (_) /___  __   / __ )(_) /______
  \__ \/ __ \/ / / __  / / __/ / / /  / __  / / __/ ___/
 ___/ / /_/ / / / /_/ / / /_/ /_/ /  / /_/ / / /_(__  ) 
/____/\____/_/_/\__,_/_/\__/\__, /  /_____/_/\__/____/  
                           /____/                        

- npm: https://www.npmjs.com/package/solidity-bits
- github: https://github.com/estarriolvetch/solidity-bits

 */

pragma solidity ^0.8.0;


library BitScan {
    uint256 constant private DEBRUIJN_256 = 0x818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff;
    bytes constant private LOOKUP_TABLE_256 = hex"0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8";

    /**
        @dev Isolate the least significant set bit.
     */ 
    function isolateLS1B256(uint256 bb) pure internal returns (uint256) {
        require(bb > 0);
        unchecked {
            return bb & (0 - bb);
        }
    } 

    /**
        @dev Isolate the most significant set bit.
     */ 
    function isolateMS1B256(uint256 bb) pure internal returns (uint256) {
        require(bb > 0);
        unchecked {
            bb |= bb >> 128;
            bb |= bb >> 64;
            bb |= bb >> 32;
            bb |= bb >> 16;
            bb |= bb >> 8;
            bb |= bb >> 4;
            bb |= bb >> 2;
            bb |= bb >> 1;
            
            return (bb >> 1) + 1;
        }
    } 

    /**
        @dev Find the index of the lest significant set bit. (trailing zero count)
     */ 
    function bitScanForward256(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return uint8(LOOKUP_TABLE_256[(isolateLS1B256(bb) * DEBRUIJN_256) >> 248]);
        }   
    }

    /**
        @dev Find the index of the most significant set bit.
     */ 
    function bitScanReverse256(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return 255 - uint8(LOOKUP_TABLE_256[((isolateMS1B256(bb) * DEBRUIJN_256) >> 248)]);
        }   
    }

    function log2(uint256 bb) pure internal returns (uint8) {
        unchecked {
            return uint8(LOOKUP_TABLE_256[(isolateMS1B256(bb) * DEBRUIJN_256) >> 248]);
        } 
    }
}
          

Compiler Settings

{"viaIR":false,"remappings":["ds-test/=lib/forge-std/lib/ds-test/src/","forge-std/=lib/forge-std/src/","ERC721Psi/=lib/ERC721Psi/contracts/","solidity-bits/=lib/solidity-bits/","openzeppelinV4/=lib/openzeppelin-contracts/contracts/","chainlink/=lib/chainlink/contracts/src/","erc4626-tests/=lib/chainlink/contracts/foundry-lib/openzeppelin-contracts/lib/erc4626-tests/","@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/","@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/","authenticated-relay/=lib/authenticated-relay/src/","sequence-market/=lib/marketplace-contracts/contracts/","openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/","@layerzerolabs/=node_modules/@layerzerolabs/","solidity-bytes-utils/=node_modules/@layerzerolabs/solidity-bytes-utils/","0xsequence/=lib/marketplace-contracts/lib/0xsequence/","@0xsequence/contracts-library/=lib/authenticated-relay/lib/contracts-library/src/","@0xsequence/erc-1155/=lib/marketplace-contracts/lib/0xsequence/erc-1155/src/","@0xsequence/erc20-meta-token/=lib/marketplace-contracts/lib/0xsequence/erc20-meta-token/src/","@axelar-network/=node_modules/@axelar-network/","@chainlink/=node_modules/@chainlink/","@eth-optimism/=node_modules/@eth-optimism/","@uniswap/lib/=lib/marketplace-contracts/lib/uniswap-lib/","contracts-library/=lib/authenticated-relay/lib/contracts-library/src/","erc721a-upgradeable/=lib/authenticated-relay/lib/contracts-library/node_modules/erc721a-upgradeable/","erc721a/=lib/authenticated-relay/lib/contracts-library/node_modules/erc721a/","hardhat-deploy/=node_modules/hardhat-deploy/","hardhat/=node_modules/hardhat/","marketplace-contracts/=lib/marketplace-contracts/contracts/","murky/=lib/authenticated-relay/lib/contracts-library/lib/murky/src/","openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/","openzeppelin-contracts/=lib/openzeppelin-contracts/","openzeppelin-v5/=lib/authenticated-relay/lib/openzeppelin-contracts/contracts/","openzeppelin/=lib/marketplace-contracts/lib/openzeppelin/","solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/","uniswap-lib/=lib/marketplace-contracts/lib/uniswap-lib/contracts/"],"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata","storageLayout"],"":["ast"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs","appendCBOR":true},"libraries":{},"evmVersion":"paris"}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"owner_","internalType":"address"}]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"event","name":"ContractCreated","inputs":[{"type":"address","name":"","internalType":"address","indexed":false},{"type":"uint256","name":"","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"deploy","inputs":[{"type":"tuple","name":"_args","internalType":"struct GenesisChampionArgs","components":[{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"symbol","internalType":"string"},{"type":"string","name":"baseURI","internalType":"string"},{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"minter","internalType":"address"},{"type":"address","name":"crafter","internalType":"address"},{"type":"address","name":"vault","internalType":"address"},{"type":"address","name":"endpointL0","internalType":"address"},{"type":"uint256","name":"defaultMaxCraftCount","internalType":"uint256"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"index","internalType":"uint256"}],"name":"deployedVersions","inputs":[{"type":"address","name":"contractAddress","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"lastDeployment","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"lastVersion","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b5060405161493238038061493283398101604081905261002f916100be565b806001600160a01b03811661005e57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6100678161006e565b50506100ee565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100d057600080fd5b81516001600160a01b03811681146100e757600080fd5b9392505050565b614835806100fd6000396000f3fe60806040523480156200001157600080fd5b5060043610620000875760003560e01c8063715018a61162000062578063715018a614620000f95780638da5cb5b1462000105578063ec9c5bc01462000117578063f2fde38b146200014e57600080fd5b8063088d9034146200008c57806345650c0714620000c257806364dfea0614620000ef575b600080fd5b620000af6200009d36600462000347565b60016020526000908152604090205481565b6040519081526020015b60405180910390f35b600254620000d6906001600160a01b031681565b6040516001600160a01b039091168152602001620000b9565b620000af60035481565b6200010362000165565b005b6000546001600160a01b0316620000d6565b6200012e620001283660046200036c565b6200017d565b604080516001600160a01b039093168352602083019190915201620000b9565b620001036200015f36600462000347565b62000255565b6200016f6200029d565b6200017b6000620002cc565b565b6000806200018a6200029d565b600060035460016200019d9190620003ab565b9050600084604051620001b0906200031c565b620001bc91906200044c565b604051809103906000f080158015620001d9573d6000803e3d6000fd5b506001600160a01b038116600081815260016020908152604091829020869055600280546001600160a01b0319168417905560038690558151928352820185905291925082917f1dc05c1d6a563dddb6c22082af72b54ec2f0207ceb55db5d13cdabc208f303a9910160405180910390a1935090915050915091565b6200025f6200029d565b6001600160a01b0381166200028f57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6200029a81620002cc565b50565b6000546001600160a01b031633146200017b5760405163118cdaa760e01b815233600482015260240162000286565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b614273806200058d83390190565b80356001600160a01b03811681146200034257600080fd5b919050565b6000602082840312156200035a57600080fd5b62000365826200032a565b9392505050565b6000602082840312156200037f57600080fd5b813567ffffffffffffffff8111156200039757600080fd5b820161012081850312156200036557600080fd5b80820180821115620003cd57634e487b7160e01b600052601160045260246000fd5b92915050565b6000808335601e19843603018112620003eb57600080fd5b830160208101925035905067ffffffffffffffff8111156200040c57600080fd5b8036038213156200041c57600080fd5b9250929050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006200045e8384620003d3565b610120806020860152620004786101408601838562000423565b9250620004896020870187620003d3565b9250601f1980878603016040880152620004a585858462000423565b9450620004b66040890189620003d3565b945091508087860301606088015250620004d284848362000423565b935050620004e3606087016200032a565b6001600160a01b0381166080870152915062000502608087016200032a565b6001600160a01b03811660a087015291506200052160a087016200032a565b6001600160a01b03811660c087015291506200054060c087016200032a565b6001600160a01b03811660e087015291506200055f60e087016200032a565b915061010062000579818701846001600160a01b03169052565b959095013593909401929092525091905056fe60c06040523480156200001157600080fd5b506040516200427338038062004273833981016040819052620000349162000527565b60e08101516060820151825160208401518391839182919060016200005a8382620006e7565b506002620000698282620006e7565b50600160045550506001600160a01b038116620000a157604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b620000ac8162000201565b506001600160a01b038083166080528116620000db57604051632d618d8160e21b815260040160405180910390fd5b60805160405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b1580156200012357600080fd5b505af115801562000138573d6000803e3d6000fd5b5050505050505050620001596000801b82606001516200025360201b60201c565b60808101516001600160a01b0316156200019257620001926000805160206200425383398151915282608001516200026360201b60201c565b60a08101516001600160a01b031615620001cb57620001cb600080516020620042538339815191528260a001516200026360201b60201c565b60c0810151620001de9061038462000307565b6040810151600c90620001f29082620006e7565b50610100015160a052620007b3565b600d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6200025f828262000263565b5050565b6000828152600b602090815260408083206001600160a01b038516845290915290205460ff166200025f576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620002c33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6127106001600160601b0382161115620003775760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840162000098565b6001600160a01b038216620003cf5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640162000098565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b634e487b7160e01b600052604160045260246000fd5b60405161012081016001600160401b038111828210171562000444576200044462000408565b60405290565b604051601f8201601f191681016001600160401b038111828210171562000475576200047562000408565b604052919050565b600082601f8301126200048f57600080fd5b81516001600160401b03811115620004ab57620004ab62000408565b6020620004c1601f8301601f191682016200044a565b8281528582848701011115620004d657600080fd5b60005b83811015620004f6578581018301518282018401528201620004d9565b506000928101909101919091529392505050565b80516001600160a01b03811681146200052257600080fd5b919050565b6000602082840312156200053a57600080fd5b81516001600160401b03808211156200055257600080fd5b9083019061012082860312156200056857600080fd5b620005726200041e565b8251828111156200058257600080fd5b62000590878286016200047d565b825250602083015182811115620005a657600080fd5b620005b4878286016200047d565b602083015250604083015182811115620005cd57600080fd5b620005db878286016200047d565b604083015250620005ef606084016200050a565b606082015262000602608084016200050a565b60808201526200061560a084016200050a565b60a08201526200062860c084016200050a565b60c08201526200063b60e084016200050a565b60e08201526101009283015192810192909252509392505050565b600181811c908216806200066b57607f821691505b6020821081036200068c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620006e2576000816000526020600020601f850160051c81016020861015620006bd5750805b601f850160051c820191505b81811015620006de57828155600101620006c9565b5050505b505050565b81516001600160401b0381111562000703576200070362000408565b6200071b8162000714845462000656565b8462000692565b602080601f8311600181146200075357600084156200073a5750858301515b600019600386901b1c1916600185901b178555620006de565b600085815260208120601f198616915b82811015620007845788860151825594840194600190910190840162000763565b5085821015620007a35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051613a506200080360003960006106df01526000818161050201528181610ad70152818161129b015281816118d101528181611cde0152818161212f01526121e80152613a506000f3fe6080604052600436106102515760003560e01c8063715018a611610139578063b2c12fc6116100b6578063d53913931161007a578063d53913931461078e578063d547741f146107c2578063d691e43c146107e2578063e985e9c514610802578063f2fde38b1461084b578063ff7bd03d1461086b57600080fd5b8063b2c12fc6146106cd578063b88d4fde14610701578063bb0b6a5314610721578063c87b56dd1461074e578063ca5eb5e11461076e57600080fd5b80638da5cb5b116100fd5780638da5cb5b1461064557806391d148541461066357806395d89b4114610683578063a217fddf14610698578063a22cb465146106ad57600080fd5b8063715018a6146105795780637d25a05e1461058e57806382413eac146105c95780638462151c146105f857806384c1ee991461062557600080fd5b80632a55205a116101d257806342842e0e1161019657806342842e0e146104b057806355f804b3146104d05780635e280f11146104f05780636352211e146105245780636c0360eb1461054457806370a082311461055957600080fd5b80632a55205a146103dc5780632f2ff15d1461041b5780633400288b1461043b57806336568abe1461045b57806340c10f191461047b57600080fd5b806317442b701161021957806317442b701461031a57806318160ddd1461033c57806323b872dd1461035f578063248a9ca31461037f57806326d140fd146103af57600080fd5b806301ffc9a71461025657806306fdde031461028b578063081812fc146102ad578063095ea7b3146102e557806313137d6514610307575b600080fd5b34801561026257600080fd5b50610276610271366004612cda565b61088b565b60405190151581526020015b60405180910390f35b34801561029757600080fd5b506102a061089c565b6040516102829190612d47565b3480156102b957600080fd5b506102cd6102c8366004612d5a565b61092e565b6040516001600160a01b039091168152602001610282565b3480156102f157600080fd5b50610305610300366004612d88565b6109be565b005b610305610315366004612e0d565b610ad5565b34801561032657600080fd5b5060408051600181526002602082015201610282565b34801561034857600080fd5b50610351610b90565b604051908152602001610282565b34801561036b57600080fd5b5061030561037a366004612eac565b610b9f565b34801561038b57600080fd5b5061035161039a366004612d5a565b6000908152600b602052604090206001015490565b3480156103bb57600080fd5b506103cf6103ca366004612fb1565b610bd0565b604051610282919061302f565b3480156103e857600080fd5b506103fc6103f7366004613046565b610c2b565b604080516001600160a01b039093168352602083019190915201610282565b34801561042757600080fd5b50610305610436366004613068565b610cd9565b34801561044757600080fd5b50610305610456366004613098565b610cfe565b34801561046757600080fd5b50610305610476366004613068565b610d14565b34801561048757600080fd5b5061049b610496366004612d88565b610d8e565b60408051928352602083019190915201610282565b3480156104bc57600080fd5b506103056104cb366004612eac565b610df5565b3480156104dc57600080fd5b506103056104eb3660046130b4565b610e10565b3480156104fc57600080fd5b506102cd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561053057600080fd5b506102cd61053f366004612d5a565b610e5e565b34801561055057600080fd5b506102a0610e72565b34801561056557600080fd5b506103516105743660046130f5565b610f00565b34801561058557600080fd5b50610305610f0b565b34801561059a57600080fd5b506105b16105a9366004613098565b600092915050565b6040516001600160401b039091168152602001610282565b3480156105d557600080fd5b506102766105e4366004613112565b6001600160a01b0381163014949350505050565b34801561060457600080fd5b506106186106133660046130f5565b610f1f565b6040516102829190613178565b6106386106333660046131bc565b610fe5565b604051610282919061322c565b34801561065157600080fd5b50600d546001600160a01b03166102cd565b34801561066f57600080fd5b5061027661067e366004613068565b6110d7565b34801561068f57600080fd5b506102a0611102565b3480156106a457600080fd5b50610351600081565b3480156106b957600080fd5b506103056106c836600461326e565b611111565b3480156106d957600080fd5b506103517f000000000000000000000000000000000000000000000000000000000000000081565b34801561070d57600080fd5b5061030561071c36600461329c565b6111e2565b34801561072d57600080fd5b5061035161073c366004613307565b600e6020526000908152604090205481565b34801561075a57600080fd5b506102a0610769366004612d5a565b611214565b34801561077a57600080fd5b506103056107893660046130f5565b611274565b34801561079a57600080fd5b506103517f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b3480156107ce57600080fd5b506103056107dd366004613068565b6112fa565b3480156107ee57600080fd5b506103056107fd366004613322565b61131f565b34801561080e57600080fd5b5061027661081d36600461335c565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561085757600080fd5b506103056108663660046130f5565b611383565b34801561087757600080fd5b5061027661088636600461338a565b6113c1565b6000610896826113f7565b92915050565b6060600180546108ab906133a6565b80601f01602080910402602001604051908101604052809291908181526020018280546108d7906133a6565b80156109245780601f106108f957610100808354040283529160200191610924565b820191906000526020600020905b81548152906001019060200180831161090757829003601f168201915b5050505050905090565b60006109398261141c565b6109a25760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b60006109c982610e5e565b9050806001600160a01b0316836001600160a01b031603610a385760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610999565b336001600160a01b0382161480610a545750610a54813361081d565b610ac65760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608401610999565b610ad08383611427565b505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163314610b20576040516391ac5e4f60e01b8152336004820152602401610999565b60208701803590610b3a90610b35908a613307565b611495565b14610b7857610b4c6020880188613307565b60405163309afaf360e21b815263ffffffff909116600482015260208801356024820152604401610999565b610b87878787878787876114d1565b50505050505050565b6000610b9a6115b9565b905090565b610ba933826115d5565b610bc55760405162461bcd60e51b8152600401610999906133da565b610ad08383836116c2565b6040805180820190915260008082526020820152604080516001600160a01b03871660208201529081018590526000906060016040516020818303038152906040529050610c20878286866118bb565b979650505050505050565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610ca05750604080518082019091526009546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610cbf906001600160601b031687613444565b610cc9919061345b565b91519350909150505b9250929050565b6000828152600b6020526040902060010154610cf48161199c565b610ad083836119a6565b610d06611a2c565b610d108282611a59565b5050565b6001600160a01b0381163314610d845760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610999565b610d108282611aae565b6000807f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610dbb8161199c565b6000610dc660045490565b9050610dd28686611b15565b806001610dde60045490565b610de8919061347d565b9350935050509250929050565b610ad0838383604051806020016040528060008152506111e2565b6000610e1b8161199c565b6000600c8054610e2a906133a6565b90501115610e4b57604051636f2c52f960e01b815260040160405180910390fd5b600c610e588385836134d8565b50505050565b600080610e6a83611b2f565b509392505050565b600c8054610e7f906133a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610eab906133a6565b8015610ef85780601f10610ecd57610100808354040283529160200191610ef8565b820191906000526020600020905b815481529060010190602001808311610edb57829003601f168201915b505050505081565b600061089682611bc6565b610f13611a2c565b610f1d6000611c59565b565b6060600080610f2d84610f00565b90506000816001600160401b03811115610f4957610f49612f01565b604051908082528060200260200182016040528015610f72578160200160208202803683370190505b50905060015b828414610fdc57610f888161141c565b15610fd457856001600160a01b0316610fa082610e5e565b6001600160a01b031603610fd45780828580600101965081518110610fc757610fc7613597565b6020026020010181815250505b600101610f78565b50949350505050565b610fed612c7d565b610ff8853086610b9f565b604080516001600160a01b038716602082015290810185905260009060600160408051601f198184030181526020601f8701819004810284018101909252858352925061107b918991849190889088908190840183828082843760009201829052506040805180820190915234815260208101919091529250339150611cab9050565b604080516001600160a01b03891681526020810188905263ffffffff8a168183015290519193507f2cfebe4d07f20816eeb64dacd20e503965d22d6390231e9a51228b29056f674c919081900360600190a15095945050505050565b6000918252600b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600280546108ab906133a6565b336001600160a01b038316036111695760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606401610999565b3360008181526006602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516111d6911515815260200190565b60405180910390a35050565b6111ec33836115d5565b6112085760405162461bcd60e51b8152600401610999906133da565b610e5884848484611dab565b606061121f8261141c565b61123c5760405163851b21c360e01b815260040160405180910390fd5b611244611de0565b61124d83611def565b60405160200161125e9291906135ad565b6040516020818303038152906040529050919050565b61127c611a2c565b60405163ca5eb5e160e01b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063ca5eb5e190602401600060405180830381600087803b1580156112df57600080fd5b505af11580156112f3573d6000803e3d6000fd5b5050505050565b6000828152600b60205260409020600101546113158161199c565b610ad08383611aae565b600061132a8161199c565b6113348383611e81565b604080516001600160a01b03851681526001600160601b03841660208201527fe643f702c57582349cab681dcd381d92c6afdb21ad79bbb906f76aa0cd37bc7b910160405180910390a1505050565b61138b611a2c565b6001600160a01b0381166113b557604051631e4fbdf760e01b815260006004820152602401610999565b6113be81611c59565b50565b600060208201803590600e9083906113d99086613307565b63ffffffff1681526020810191909152604001600020541492915050565b60006001600160e01b03198216637965db0b60e01b1480610896575061089682611f7e565b600061089682611fa3565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061145c82610e5e565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b63ffffffff81166000908152600e6020526040812054806108965760405163f6ff4fb760e01b815263ffffffff84166004820152602401610999565b6000806114e086880188612d88565b9092509050306114ef82610e5e565b6001600160a01b0316146115455760405162461bcd60e51b815260206004820152601e60248201527f636f6e747261637420646f65736e2774206f776e2074686520746f6b656e00006044820152606401610999565b6115503083836116c2565b7fcb2275453df8f26982a1385e9c65a5a00faccd1325fcbbc8745387d6e2524f10828261158060208d018d613307565b604080516001600160a01b039094168452602084019290925263ffffffff169082015260600160405180910390a1505050505050505050565b60006115c3611fd9565b6115cb612030565b610b9a919061347d565b60006115e08261141c565b6116445760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610999565b600061164f83610e5e565b9050806001600160a01b0316846001600160a01b0316148061168a5750836001600160a01b031661167f8461092e565b6001600160a01b0316145b806116ba57506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b949350505050565b6000806116ce83611b2f565b91509150846001600160a01b0316826001600160a01b0316146117485760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610999565b6001600160a01b0384166117ae5760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610999565b6117b9600084611427565b60006117c68460016135ec565b600881901c600090815260208190526040902054909150600160ff1b60ff83161c161580156117f6575060045481105b1561182c57600081815260036020526040812080546001600160a01b0319166001600160a01b03891617905561182c9082612041565b600084815260036020526040902080546001600160a01b0319166001600160a01b03871617905581841461186557611865600085612041565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46118b3868686600161206d565b505050505050565b60408051808201909152600080825260208201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ddc28c586040518060a001604052808863ffffffff16815260200161191e89611495565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b81526004016119539291906135ff565b6040805180830381865afa15801561196f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199391906136c6565b95945050505050565b6113be8133612079565b6119b082826110d7565b610d10576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556119e83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600d546001600160a01b03163314610f1d5760405163118cdaa760e01b8152336004820152602401610999565b63ffffffff82166000818152600e6020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b611ab882826110d7565b15610d10576000828152600b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610d108282604051806020016040528060008152506120d2565b600080611b3b8361141c565b611b9c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610999565b611ba5836120f7565b6000818152600360205260409020546001600160a01b031694909350915050565b60006001600160a01b038216611c345760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610999565b506001600160a01b03166000908152600760205260409020546001600160401b031690565b600d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611cb3612c7d565b6000611cc28460000151612103565b602085015190915015611cdc57611cdc846020015161212b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632637a450826040518060a001604052808b63ffffffff168152602001611d2c8c611495565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b8152600401611d689291906135ff565b60806040518083038185885af1158015611d86573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c2091906136e2565b611db68484846116c2565b611dc484848460018561220d565b610e585760405162461bcd60e51b815260040161099990613753565b6060600c80546108ab906133a6565b60606000611dfc83612335565b60010190506000816001600160401b03811115611e1b57611e1b612f01565b6040519080825280601f01601f191660200182016040528015611e45576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611e4f57509392505050565b6127106001600160601b0382161115611eef5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610999565b6001600160a01b038216611f455760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610999565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b60006001600160e01b0319821663152a902d60e11b148061089657506108968261240d565b600881811c60009081526020919091526040812054600160ff1b60ff84161c1615611fd057506000919050565b6108968261245d565b60045460009081908190611ff19060081c60016135ec565b9050815b8181101561202a5760008181526008602052604090205461201581612479565b61201f90866135ec565b945050600101611ff5565b50505090565b60006001600454610b9a919061347d565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b610e5884848484612498565b61208382826110d7565b610d105761209081612616565b61209b836020612628565b6040516020016120ac9291906137a8565b60408051601f198184030181529082905262461bcd60e51b825261099991600401612d47565b60006120dd60045490565b90506120e984846127ca565b611dc460008583868661220d565b6000610896818361293f565b6000813414612127576040516304fb820960e51b8152346004820152602401610999565b5090565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e4fe1d946040518163ffffffff1660e01b8152600401602060405180830381865afa15801561218b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121af919061381d565b90506001600160a01b0381166121d8576040516329b99a9560e11b815260040160405180910390fd5b610d106001600160a01b038216337f000000000000000000000000000000000000000000000000000000000000000085612a37565b60006001600160a01b0385163b1561232d57506001835b61222e84866135ec565b81101561232757604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906122679033908b908690899060040161383a565b6020604051808303816000875af19250505080156122a2575060408051601f3d908101601f1916820190925261229f9181019061386d565b60015b6122ff573d8080156122d0576040519150601f19603f3d011682016040523d82523d6000602084013e6122d5565b606091505b5080516000036122f75760405162461bcd60e51b815260040161099990613753565b805181602001fd5b82801561231c57506001600160e01b03198116630a85bd0160e11b145b925050600101612224565b50611993565b506001611993565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106123745772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106123a0576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106123be57662386f26fc10000830492506010015b6305f5e10083106123d6576305f5e100830492506008015b61271083106123ea57612710830492506004015b606483106123fc576064830492506002015b600a83106108965760010192915050565b60006001600160e01b031982166380ac58cd60e01b148061243e57506001600160e01b03198216635b5e139f60e01b145b8061089657506301ffc9a760e01b6001600160e01b0319831614610896565b600061246860045490565b821080156108965750506001111590565b60005b81156124935760001982019091169060010161247c565b919050565b600160401b81106124a857600080fd5b806001600160a01b03851615612512576001600160a01b038516600090815260076020526040812080548392906124e99084906001600160401b031661388a565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550612572565b6001600160a01b0384166000908152600760205260409020805482919060089061254d908490600160401b90046001600160401b03166138aa565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b038416156125db576001600160a01b038416600090815260076020526040812080548392906125b29084906001600160401b03166138aa565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506112f3565b6001600160a01b038516600090815260076020526040902080548291906010906125b2908490600160801b90046001600160401b03166138aa565b60606108966001600160a01b03831660145b60606000612637836002613444565b6126429060026135ec565b6001600160401b0381111561265957612659612f01565b6040519080825280601f01601f191660200182016040528015612683576020820181803683370190505b509050600360fc1b8160008151811061269e5761269e613597565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106126cd576126cd613597565b60200101906001600160f81b031916908160001a90535060006126f1846002613444565b6126fc9060016135ec565b90505b6001811115612774576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061273057612730613597565b1a60f81b82828151811061274657612746613597565b60200101906001600160f81b031916908160001a90535060049490941c9361276d816138ca565b90506126ff565b5083156127c35760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610999565b9392505050565b60006127d560045490565b9050600082116128355760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610999565b6001600160a01b0383166128975760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610999565b81600460008282546128a991906135ec565b9091555050600081815260036020526040812080546001600160a01b0319166001600160a01b0386161790556128df9082612041565b6128ec600084838561206d565b805b6128f883836135ec565b811015610e585760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46001016128ee565b600881901c60008181526020849052604081205490919060ff808516919082181c80156129815761296f81612a91565b60ff168203600884901b179350612a2e565b600083116129ee5760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610999565b506000199091016000818152602086905260409020549091908015612a2957612a1681612a91565b60ff0360ff16600884901b179350612a2e565b612981565b50505092915050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610e58908590612afb565b6000604051806101200160405280610100815260200161391b610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff612ada85612b5e565b02901c81518110612aed57612aed613597565b016020015160f81c92915050565b6000612b106001600160a01b03841683612b76565b90508051600014158015612b35575080806020019051810190612b3391906138e1565b155b15610ad057604051635274afe760e01b81526001600160a01b0384166004820152602401610999565b6000808211612b6c57600080fd5b5060008190031690565b60606127c38383600084600080856001600160a01b03168486604051612b9c91906138fe565b60006040518083038185875af1925050503d8060008114612bd9576040519150601f19603f3d011682016040523d82523d6000602084013e612bde565b606091505b5091509150612bee868383612bf8565b9695505050505050565b606082612c0d57612c0882612c54565b6127c3565b8151158015612c2457506001600160a01b0384163b155b15612c4d57604051639996b31560e01b81526001600160a01b0385166004820152602401610999565b50806127c3565b805115612c645780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60405180606001604052806000801916815260200160006001600160401b03168152602001612cbf604051806040016040528060008152602001600081525090565b905290565b6001600160e01b0319811681146113be57600080fd5b600060208284031215612cec57600080fd5b81356127c381612cc4565b60005b83811015612d12578181015183820152602001612cfa565b50506000910152565b60008151808452612d33816020860160208601612cf7565b601f01601f19169290920160200192915050565b6020815260006127c36020830184612d1b565b600060208284031215612d6c57600080fd5b5035919050565b6001600160a01b03811681146113be57600080fd5b60008060408385031215612d9b57600080fd5b8235612da681612d73565b946020939093013593505050565b600060608284031215612dc657600080fd5b50919050565b60008083601f840112612dde57600080fd5b5081356001600160401b03811115612df557600080fd5b602083019150836020828501011115610cd257600080fd5b600080600080600080600060e0888a031215612e2857600080fd5b612e328989612db4565b96506060880135955060808801356001600160401b0380821115612e5557600080fd5b612e618b838c01612dcc565b909750955060a08a01359150612e7682612d73565b90935060c08901359080821115612e8c57600080fd5b50612e998a828b01612dcc565b989b979a50959850939692959293505050565b600080600060608486031215612ec157600080fd5b8335612ecc81612d73565b92506020840135612edc81612d73565b929592945050506040919091013590565b803563ffffffff8116811461249357600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f830112612f2857600080fd5b81356001600160401b0380821115612f4257612f42612f01565b604051601f8301601f19908116603f01168101908282118183101715612f6a57612f6a612f01565b81604052838152866020858801011115612f8357600080fd5b836020870160208301376000602085830101528094505050505092915050565b80151581146113be57600080fd5b600080600080600060a08688031215612fc957600080fd5b612fd286612eed565b94506020860135612fe281612d73565b93506040860135925060608601356001600160401b0381111561300457600080fd5b61301088828901612f17565b925050608086013561302181612fa3565b809150509295509295909350565b815181526020808301519082015260408101610896565b6000806040838503121561305957600080fd5b50508035926020909101359150565b6000806040838503121561307b57600080fd5b82359150602083013561308d81612d73565b809150509250929050565b600080604083850312156130ab57600080fd5b612da683612eed565b600080602083850312156130c757600080fd5b82356001600160401b038111156130dd57600080fd5b6130e985828601612dcc565b90969095509350505050565b60006020828403121561310757600080fd5b81356127c381612d73565b60008060008060a0858703121561312857600080fd5b6131328686612db4565b935060608501356001600160401b0381111561314d57600080fd5b61315987828801612dcc565b909450925050608085013561316d81612d73565b939692955090935050565b6020808252825182820181905260009190848201906040850190845b818110156131b057835183529284019291840191600101613194565b50909695505050505050565b6000806000806000608086880312156131d457600080fd5b6131dd86612eed565b945060208601356131ed81612d73565b93506040860135925060608601356001600160401b0381111561320f57600080fd5b61321b88828901612dcc565b969995985093965092949392505050565b6000608082019050825182526001600160401b0360208401511660208301526040830151613267604084018280518252602090810151910152565b5092915050565b6000806040838503121561328157600080fd5b823561328c81612d73565b9150602083013561308d81612fa3565b600080600080608085870312156132b257600080fd5b84356132bd81612d73565b935060208501356132cd81612d73565b92506040850135915060608501356001600160401b038111156132ef57600080fd5b6132fb87828801612f17565b91505092959194509250565b60006020828403121561331957600080fd5b6127c382612eed565b6000806040838503121561333557600080fd5b823561334081612d73565b915060208301356001600160601b038116811461308d57600080fd5b6000806040838503121561336f57600080fd5b823561337a81612d73565b9150602083013561308d81612d73565b60006060828403121561339c57600080fd5b6127c38383612db4565b600181811c908216806133ba57607f821691505b602082108103612dc657634e487b7160e01b600052602260045260246000fd5b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176108965761089661342e565b60008261347857634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156108965761089661342e565b601f821115610ad0576000816000526020600020601f850160051c810160208610156134b95750805b601f850160051c820191505b818110156118b3578281556001016134c5565b6001600160401b038311156134ef576134ef612f01565b613503836134fd83546133a6565b83613490565b6000601f841160018114613537576000851561351f5750838201355b600019600387901b1c1916600186901b1783556112f3565b600083815260209020601f19861690835b828110156135685786850135825560209485019460019092019101613548565b50868210156135855760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052603260045260246000fd5b600083516135bf818460208801612cf7565b8351908301906135d3818360208801612cf7565b64173539b7b760d91b9101908152600501949350505050565b808201808211156108965761089661342e565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a0608084015261363560e0840182612d1b565b90506060850151603f198483030160a08501526136528282612d1b565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b60006040828403121561368a57600080fd5b604051604081018181106001600160401b03821117156136ac576136ac612f01565b604052825181526020928301519281019290925250919050565b6000604082840312156136d857600080fd5b6127c38383613678565b6000608082840312156136f457600080fd5b604051606081016001600160401b03828210818311171561371757613717612f01565b816040528451835260208501519150808216821461373457600080fd5b5060208201526137478460408501613678565b60408201529392505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516137e0816017850160208801612cf7565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613811816028840160208801612cf7565b01602801949350505050565b60006020828403121561382f57600080fd5b81516127c381612d73565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612bee90830184612d1b565b60006020828403121561387f57600080fd5b81516127c381612cc4565b6001600160401b038281168282160390808211156132675761326761342e565b6001600160401b038181168382160190808211156132675761326761342e565b6000816138d9576138d961342e565b506000190190565b6000602082840312156138f357600080fd5b81516127c381612fa3565b60008251613910818460208701612cf7565b919091019291505056fe0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a26469706673582212204b5aca314fdbbb975660012d7bfaa2f0fbc7745f9cffdb9993a514a394007dd264736f6c634300081800339f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6a264697066735822122052820dd1e572389a61bc043dee382adfc10443e5c779d45b7def0ff121fbb87764736f6c63430008180033000000000000000000000000bb411bba014ee684428ded9581e773dd754efd4d

Deployed ByteCode

0x60806040523480156200001157600080fd5b5060043610620000875760003560e01c8063715018a61162000062578063715018a614620000f95780638da5cb5b1462000105578063ec9c5bc01462000117578063f2fde38b146200014e57600080fd5b8063088d9034146200008c57806345650c0714620000c257806364dfea0614620000ef575b600080fd5b620000af6200009d36600462000347565b60016020526000908152604090205481565b6040519081526020015b60405180910390f35b600254620000d6906001600160a01b031681565b6040516001600160a01b039091168152602001620000b9565b620000af60035481565b6200010362000165565b005b6000546001600160a01b0316620000d6565b6200012e620001283660046200036c565b6200017d565b604080516001600160a01b039093168352602083019190915201620000b9565b620001036200015f36600462000347565b62000255565b6200016f6200029d565b6200017b6000620002cc565b565b6000806200018a6200029d565b600060035460016200019d9190620003ab565b9050600084604051620001b0906200031c565b620001bc91906200044c565b604051809103906000f080158015620001d9573d6000803e3d6000fd5b506001600160a01b038116600081815260016020908152604091829020869055600280546001600160a01b0319168417905560038690558151928352820185905291925082917f1dc05c1d6a563dddb6c22082af72b54ec2f0207ceb55db5d13cdabc208f303a9910160405180910390a1935090915050915091565b6200025f6200029d565b6001600160a01b0381166200028f57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b6200029a81620002cc565b50565b6000546001600160a01b031633146200017b5760405163118cdaa760e01b815233600482015260240162000286565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b614273806200058d83390190565b80356001600160a01b03811681146200034257600080fd5b919050565b6000602082840312156200035a57600080fd5b62000365826200032a565b9392505050565b6000602082840312156200037f57600080fd5b813567ffffffffffffffff8111156200039757600080fd5b820161012081850312156200036557600080fd5b80820180821115620003cd57634e487b7160e01b600052601160045260246000fd5b92915050565b6000808335601e19843603018112620003eb57600080fd5b830160208101925035905067ffffffffffffffff8111156200040c57600080fd5b8036038213156200041c57600080fd5b9250929050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006200045e8384620003d3565b610120806020860152620004786101408601838562000423565b9250620004896020870187620003d3565b9250601f1980878603016040880152620004a585858462000423565b9450620004b66040890189620003d3565b945091508087860301606088015250620004d284848362000423565b935050620004e3606087016200032a565b6001600160a01b0381166080870152915062000502608087016200032a565b6001600160a01b03811660a087015291506200052160a087016200032a565b6001600160a01b03811660c087015291506200054060c087016200032a565b6001600160a01b03811660e087015291506200055f60e087016200032a565b915061010062000579818701846001600160a01b03169052565b959095013593909401929092525091905056fe60c06040523480156200001157600080fd5b506040516200427338038062004273833981016040819052620000349162000527565b60e08101516060820151825160208401518391839182919060016200005a8382620006e7565b506002620000698282620006e7565b50600160045550506001600160a01b038116620000a157604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b620000ac8162000201565b506001600160a01b038083166080528116620000db57604051632d618d8160e21b815260040160405180910390fd5b60805160405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b1580156200012357600080fd5b505af115801562000138573d6000803e3d6000fd5b5050505050505050620001596000801b82606001516200025360201b60201c565b60808101516001600160a01b0316156200019257620001926000805160206200425383398151915282608001516200026360201b60201c565b60a08101516001600160a01b031615620001cb57620001cb600080516020620042538339815191528260a001516200026360201b60201c565b60c0810151620001de9061038462000307565b6040810151600c90620001f29082620006e7565b50610100015160a052620007b3565b600d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6200025f828262000263565b5050565b6000828152600b602090815260408083206001600160a01b038516845290915290205460ff166200025f576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620002c33390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6127106001600160601b0382161115620003775760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840162000098565b6001600160a01b038216620003cf5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c696420726563656976657200000000000000604482015260640162000098565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b634e487b7160e01b600052604160045260246000fd5b60405161012081016001600160401b038111828210171562000444576200044462000408565b60405290565b604051601f8201601f191681016001600160401b038111828210171562000475576200047562000408565b604052919050565b600082601f8301126200048f57600080fd5b81516001600160401b03811115620004ab57620004ab62000408565b6020620004c1601f8301601f191682016200044a565b8281528582848701011115620004d657600080fd5b60005b83811015620004f6578581018301518282018401528201620004d9565b506000928101909101919091529392505050565b80516001600160a01b03811681146200052257600080fd5b919050565b6000602082840312156200053a57600080fd5b81516001600160401b03808211156200055257600080fd5b9083019061012082860312156200056857600080fd5b620005726200041e565b8251828111156200058257600080fd5b62000590878286016200047d565b825250602083015182811115620005a657600080fd5b620005b4878286016200047d565b602083015250604083015182811115620005cd57600080fd5b620005db878286016200047d565b604083015250620005ef606084016200050a565b606082015262000602608084016200050a565b60808201526200061560a084016200050a565b60a08201526200062860c084016200050a565b60c08201526200063b60e084016200050a565b60e08201526101009283015192810192909252509392505050565b600181811c908216806200066b57607f821691505b6020821081036200068c57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620006e2576000816000526020600020601f850160051c81016020861015620006bd5750805b601f850160051c820191505b81811015620006de57828155600101620006c9565b5050505b505050565b81516001600160401b0381111562000703576200070362000408565b6200071b8162000714845462000656565b8462000692565b602080601f8311600181146200075357600084156200073a5750858301515b600019600386901b1c1916600185901b178555620006de565b600085815260208120601f198616915b82811015620007845788860151825594840194600190910190840162000763565b5085821015620007a35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a051613a506200080360003960006106df01526000818161050201528181610ad70152818161129b015281816118d101528181611cde0152818161212f01526121e80152613a506000f3fe6080604052600436106102515760003560e01c8063715018a611610139578063b2c12fc6116100b6578063d53913931161007a578063d53913931461078e578063d547741f146107c2578063d691e43c146107e2578063e985e9c514610802578063f2fde38b1461084b578063ff7bd03d1461086b57600080fd5b8063b2c12fc6146106cd578063b88d4fde14610701578063bb0b6a5314610721578063c87b56dd1461074e578063ca5eb5e11461076e57600080fd5b80638da5cb5b116100fd5780638da5cb5b1461064557806391d148541461066357806395d89b4114610683578063a217fddf14610698578063a22cb465146106ad57600080fd5b8063715018a6146105795780637d25a05e1461058e57806382413eac146105c95780638462151c146105f857806384c1ee991461062557600080fd5b80632a55205a116101d257806342842e0e1161019657806342842e0e146104b057806355f804b3146104d05780635e280f11146104f05780636352211e146105245780636c0360eb1461054457806370a082311461055957600080fd5b80632a55205a146103dc5780632f2ff15d1461041b5780633400288b1461043b57806336568abe1461045b57806340c10f191461047b57600080fd5b806317442b701161021957806317442b701461031a57806318160ddd1461033c57806323b872dd1461035f578063248a9ca31461037f57806326d140fd146103af57600080fd5b806301ffc9a71461025657806306fdde031461028b578063081812fc146102ad578063095ea7b3146102e557806313137d6514610307575b600080fd5b34801561026257600080fd5b50610276610271366004612cda565b61088b565b60405190151581526020015b60405180910390f35b34801561029757600080fd5b506102a061089c565b6040516102829190612d47565b3480156102b957600080fd5b506102cd6102c8366004612d5a565b61092e565b6040516001600160a01b039091168152602001610282565b3480156102f157600080fd5b50610305610300366004612d88565b6109be565b005b610305610315366004612e0d565b610ad5565b34801561032657600080fd5b5060408051600181526002602082015201610282565b34801561034857600080fd5b50610351610b90565b604051908152602001610282565b34801561036b57600080fd5b5061030561037a366004612eac565b610b9f565b34801561038b57600080fd5b5061035161039a366004612d5a565b6000908152600b602052604090206001015490565b3480156103bb57600080fd5b506103cf6103ca366004612fb1565b610bd0565b604051610282919061302f565b3480156103e857600080fd5b506103fc6103f7366004613046565b610c2b565b604080516001600160a01b039093168352602083019190915201610282565b34801561042757600080fd5b50610305610436366004613068565b610cd9565b34801561044757600080fd5b50610305610456366004613098565b610cfe565b34801561046757600080fd5b50610305610476366004613068565b610d14565b34801561048757600080fd5b5061049b610496366004612d88565b610d8e565b60408051928352602083019190915201610282565b3480156104bc57600080fd5b506103056104cb366004612eac565b610df5565b3480156104dc57600080fd5b506103056104eb3660046130b4565b610e10565b3480156104fc57600080fd5b506102cd7f000000000000000000000000000000000000000000000000000000000000000081565b34801561053057600080fd5b506102cd61053f366004612d5a565b610e5e565b34801561055057600080fd5b506102a0610e72565b34801561056557600080fd5b506103516105743660046130f5565b610f00565b34801561058557600080fd5b50610305610f0b565b34801561059a57600080fd5b506105b16105a9366004613098565b600092915050565b6040516001600160401b039091168152602001610282565b3480156105d557600080fd5b506102766105e4366004613112565b6001600160a01b0381163014949350505050565b34801561060457600080fd5b506106186106133660046130f5565b610f1f565b6040516102829190613178565b6106386106333660046131bc565b610fe5565b604051610282919061322c565b34801561065157600080fd5b50600d546001600160a01b03166102cd565b34801561066f57600080fd5b5061027661067e366004613068565b6110d7565b34801561068f57600080fd5b506102a0611102565b3480156106a457600080fd5b50610351600081565b3480156106b957600080fd5b506103056106c836600461326e565b611111565b3480156106d957600080fd5b506103517f000000000000000000000000000000000000000000000000000000000000000081565b34801561070d57600080fd5b5061030561071c36600461329c565b6111e2565b34801561072d57600080fd5b5061035161073c366004613307565b600e6020526000908152604090205481565b34801561075a57600080fd5b506102a0610769366004612d5a565b611214565b34801561077a57600080fd5b506103056107893660046130f5565b611274565b34801561079a57600080fd5b506103517f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b3480156107ce57600080fd5b506103056107dd366004613068565b6112fa565b3480156107ee57600080fd5b506103056107fd366004613322565b61131f565b34801561080e57600080fd5b5061027661081d36600461335c565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561085757600080fd5b506103056108663660046130f5565b611383565b34801561087757600080fd5b5061027661088636600461338a565b6113c1565b6000610896826113f7565b92915050565b6060600180546108ab906133a6565b80601f01602080910402602001604051908101604052809291908181526020018280546108d7906133a6565b80156109245780601f106108f957610100808354040283529160200191610924565b820191906000526020600020905b81548152906001019060200180831161090757829003601f168201915b5050505050905090565b60006109398261141c565b6109a25760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a20617070726f76656420717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b60648201526084015b60405180910390fd5b506000908152600560205260409020546001600160a01b031690565b60006109c982610e5e565b9050806001600160a01b0316836001600160a01b031603610a385760405162461bcd60e51b8152602060048201526024808201527f4552433732315073693a20617070726f76616c20746f2063757272656e74206f6044820152633bb732b960e11b6064820152608401610999565b336001600160a01b0382161480610a545750610a54813361081d565b610ac65760405162461bcd60e51b815260206004820152603b60248201527f4552433732315073693a20617070726f76652063616c6c6572206973206e6f7460448201527f206f776e6572206e6f7220617070726f76656420666f7220616c6c00000000006064820152608401610999565b610ad08383611427565b505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163314610b20576040516391ac5e4f60e01b8152336004820152602401610999565b60208701803590610b3a90610b35908a613307565b611495565b14610b7857610b4c6020880188613307565b60405163309afaf360e21b815263ffffffff909116600482015260208801356024820152604401610999565b610b87878787878787876114d1565b50505050505050565b6000610b9a6115b9565b905090565b610ba933826115d5565b610bc55760405162461bcd60e51b8152600401610999906133da565b610ad08383836116c2565b6040805180820190915260008082526020820152604080516001600160a01b03871660208201529081018590526000906060016040516020818303038152906040529050610c20878286866118bb565b979650505050505050565b6000828152600a602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610ca05750604080518082019091526009546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610cbf906001600160601b031687613444565b610cc9919061345b565b91519350909150505b9250929050565b6000828152600b6020526040902060010154610cf48161199c565b610ad083836119a6565b610d06611a2c565b610d108282611a59565b5050565b6001600160a01b0381163314610d845760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610999565b610d108282611aae565b6000807f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610dbb8161199c565b6000610dc660045490565b9050610dd28686611b15565b806001610dde60045490565b610de8919061347d565b9350935050509250929050565b610ad0838383604051806020016040528060008152506111e2565b6000610e1b8161199c565b6000600c8054610e2a906133a6565b90501115610e4b57604051636f2c52f960e01b815260040160405180910390fd5b600c610e588385836134d8565b50505050565b600080610e6a83611b2f565b509392505050565b600c8054610e7f906133a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610eab906133a6565b8015610ef85780601f10610ecd57610100808354040283529160200191610ef8565b820191906000526020600020905b815481529060010190602001808311610edb57829003601f168201915b505050505081565b600061089682611bc6565b610f13611a2c565b610f1d6000611c59565b565b6060600080610f2d84610f00565b90506000816001600160401b03811115610f4957610f49612f01565b604051908082528060200260200182016040528015610f72578160200160208202803683370190505b50905060015b828414610fdc57610f888161141c565b15610fd457856001600160a01b0316610fa082610e5e565b6001600160a01b031603610fd45780828580600101965081518110610fc757610fc7613597565b6020026020010181815250505b600101610f78565b50949350505050565b610fed612c7d565b610ff8853086610b9f565b604080516001600160a01b038716602082015290810185905260009060600160408051601f198184030181526020601f8701819004810284018101909252858352925061107b918991849190889088908190840183828082843760009201829052506040805180820190915234815260208101919091529250339150611cab9050565b604080516001600160a01b03891681526020810188905263ffffffff8a168183015290519193507f2cfebe4d07f20816eeb64dacd20e503965d22d6390231e9a51228b29056f674c919081900360600190a15095945050505050565b6000918252600b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600280546108ab906133a6565b336001600160a01b038316036111695760405162461bcd60e51b815260206004820152601c60248201527f4552433732315073693a20617070726f766520746f2063616c6c6572000000006044820152606401610999565b3360008181526006602090815260408083206001600160a01b0387168085529252909120805460ff1916841515179055906001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516111d6911515815260200190565b60405180910390a35050565b6111ec33836115d5565b6112085760405162461bcd60e51b8152600401610999906133da565b610e5884848484611dab565b606061121f8261141c565b61123c5760405163851b21c360e01b815260040160405180910390fd5b611244611de0565b61124d83611def565b60405160200161125e9291906135ad565b6040516020818303038152906040529050919050565b61127c611a2c565b60405163ca5eb5e160e01b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063ca5eb5e190602401600060405180830381600087803b1580156112df57600080fd5b505af11580156112f3573d6000803e3d6000fd5b5050505050565b6000828152600b60205260409020600101546113158161199c565b610ad08383611aae565b600061132a8161199c565b6113348383611e81565b604080516001600160a01b03851681526001600160601b03841660208201527fe643f702c57582349cab681dcd381d92c6afdb21ad79bbb906f76aa0cd37bc7b910160405180910390a1505050565b61138b611a2c565b6001600160a01b0381166113b557604051631e4fbdf760e01b815260006004820152602401610999565b6113be81611c59565b50565b600060208201803590600e9083906113d99086613307565b63ffffffff1681526020810191909152604001600020541492915050565b60006001600160e01b03198216637965db0b60e01b1480610896575061089682611f7e565b600061089682611fa3565b600081815260056020526040902080546001600160a01b0319166001600160a01b038416908117909155819061145c82610e5e565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b63ffffffff81166000908152600e6020526040812054806108965760405163f6ff4fb760e01b815263ffffffff84166004820152602401610999565b6000806114e086880188612d88565b9092509050306114ef82610e5e565b6001600160a01b0316146115455760405162461bcd60e51b815260206004820152601e60248201527f636f6e747261637420646f65736e2774206f776e2074686520746f6b656e00006044820152606401610999565b6115503083836116c2565b7fcb2275453df8f26982a1385e9c65a5a00faccd1325fcbbc8745387d6e2524f10828261158060208d018d613307565b604080516001600160a01b039094168452602084019290925263ffffffff169082015260600160405180910390a1505050505050505050565b60006115c3611fd9565b6115cb612030565b610b9a919061347d565b60006115e08261141c565b6116445760405162461bcd60e51b815260206004820152602f60248201527f4552433732315073693a206f70657261746f7220717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b6064820152608401610999565b600061164f83610e5e565b9050806001600160a01b0316846001600160a01b0316148061168a5750836001600160a01b031661167f8461092e565b6001600160a01b0316145b806116ba57506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b949350505050565b6000806116ce83611b2f565b91509150846001600160a01b0316826001600160a01b0316146117485760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a207472616e73666572206f6620746f6b656e2074686160448201526b3a1034b9903737ba1037bbb760a11b6064820152608401610999565b6001600160a01b0384166117ae5760405162461bcd60e51b815260206004820152602760248201527f4552433732315073693a207472616e7366657220746f20746865207a65726f206044820152666164647265737360c81b6064820152608401610999565b6117b9600084611427565b60006117c68460016135ec565b600881901c600090815260208190526040902054909150600160ff1b60ff83161c161580156117f6575060045481105b1561182c57600081815260036020526040812080546001600160a01b0319166001600160a01b03891617905561182c9082612041565b600084815260036020526040902080546001600160a01b0319166001600160a01b03871617905581841461186557611865600085612041565b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a46118b3868686600161206d565b505050505050565b60408051808201909152600080825260208201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ddc28c586040518060a001604052808863ffffffff16815260200161191e89611495565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b81526004016119539291906135ff565b6040805180830381865afa15801561196f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061199391906136c6565b95945050505050565b6113be8133612079565b6119b082826110d7565b610d10576000828152600b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556119e83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600d546001600160a01b03163314610f1d5760405163118cdaa760e01b8152336004820152602401610999565b63ffffffff82166000818152600e6020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b611ab882826110d7565b15610d10576000828152600b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b610d108282604051806020016040528060008152506120d2565b600080611b3b8361141c565b611b9c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732315073693a206f776e657220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610999565b611ba5836120f7565b6000818152600360205260409020546001600160a01b031694909350915050565b60006001600160a01b038216611c345760405162461bcd60e51b815260206004820152602d60248201527f4552433732315073693a2062616c616e636520717565727920666f722074686560448201526c207a65726f206164647265737360981b6064820152608401610999565b506001600160a01b03166000908152600760205260409020546001600160401b031690565b600d80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b611cb3612c7d565b6000611cc28460000151612103565b602085015190915015611cdc57611cdc846020015161212b565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632637a450826040518060a001604052808b63ffffffff168152602001611d2c8c611495565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b8152600401611d689291906135ff565b60806040518083038185885af1158015611d86573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c2091906136e2565b611db68484846116c2565b611dc484848460018561220d565b610e585760405162461bcd60e51b815260040161099990613753565b6060600c80546108ab906133a6565b60606000611dfc83612335565b60010190506000816001600160401b03811115611e1b57611e1b612f01565b6040519080825280601f01601f191660200182016040528015611e45576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611e4f57509392505050565b6127106001600160601b0382161115611eef5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610999565b6001600160a01b038216611f455760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610999565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600955565b60006001600160e01b0319821663152a902d60e11b148061089657506108968261240d565b600881811c60009081526020919091526040812054600160ff1b60ff84161c1615611fd057506000919050565b6108968261245d565b60045460009081908190611ff19060081c60016135ec565b9050815b8181101561202a5760008181526008602052604090205461201581612479565b61201f90866135ec565b945050600101611ff5565b50505090565b60006001600454610b9a919061347d565b600881901c600090815260209290925260409091208054600160ff1b60ff9093169290921c9091179055565b610e5884848484612498565b61208382826110d7565b610d105761209081612616565b61209b836020612628565b6040516020016120ac9291906137a8565b60408051601f198184030181529082905262461bcd60e51b825261099991600401612d47565b60006120dd60045490565b90506120e984846127ca565b611dc460008583868661220d565b6000610896818361293f565b6000813414612127576040516304fb820960e51b8152346004820152602401610999565b5090565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e4fe1d946040518163ffffffff1660e01b8152600401602060405180830381865afa15801561218b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121af919061381d565b90506001600160a01b0381166121d8576040516329b99a9560e11b815260040160405180910390fd5b610d106001600160a01b038216337f000000000000000000000000000000000000000000000000000000000000000085612a37565b60006001600160a01b0385163b1561232d57506001835b61222e84866135ec565b81101561232757604051630a85bd0160e11b81526001600160a01b0387169063150b7a02906122679033908b908690899060040161383a565b6020604051808303816000875af19250505080156122a2575060408051601f3d908101601f1916820190925261229f9181019061386d565b60015b6122ff573d8080156122d0576040519150601f19603f3d011682016040523d82523d6000602084013e6122d5565b606091505b5080516000036122f75760405162461bcd60e51b815260040161099990613753565b805181602001fd5b82801561231c57506001600160e01b03198116630a85bd0160e11b145b925050600101612224565b50611993565b506001611993565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106123745772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106123a0576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106123be57662386f26fc10000830492506010015b6305f5e10083106123d6576305f5e100830492506008015b61271083106123ea57612710830492506004015b606483106123fc576064830492506002015b600a83106108965760010192915050565b60006001600160e01b031982166380ac58cd60e01b148061243e57506001600160e01b03198216635b5e139f60e01b145b8061089657506301ffc9a760e01b6001600160e01b0319831614610896565b600061246860045490565b821080156108965750506001111590565b60005b81156124935760001982019091169060010161247c565b919050565b600160401b81106124a857600080fd5b806001600160a01b03851615612512576001600160a01b038516600090815260076020526040812080548392906124e99084906001600160401b031661388a565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550612572565b6001600160a01b0384166000908152600760205260409020805482919060089061254d908490600160401b90046001600160401b03166138aa565b92506101000a8154816001600160401b0302191690836001600160401b031602179055505b6001600160a01b038416156125db576001600160a01b038416600090815260076020526040812080548392906125b29084906001600160401b03166138aa565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506112f3565b6001600160a01b038516600090815260076020526040902080548291906010906125b2908490600160801b90046001600160401b03166138aa565b60606108966001600160a01b03831660145b60606000612637836002613444565b6126429060026135ec565b6001600160401b0381111561265957612659612f01565b6040519080825280601f01601f191660200182016040528015612683576020820181803683370190505b509050600360fc1b8160008151811061269e5761269e613597565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106126cd576126cd613597565b60200101906001600160f81b031916908160001a90535060006126f1846002613444565b6126fc9060016135ec565b90505b6001811115612774576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061273057612730613597565b1a60f81b82828151811061274657612746613597565b60200101906001600160f81b031916908160001a90535060049490941c9361276d816138ca565b90506126ff565b5083156127c35760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610999565b9392505050565b60006127d560045490565b9050600082116128355760405162461bcd60e51b815260206004820152602560248201527f4552433732315073693a207175616e74697479206d7573742062652067726561604482015264074657220360dc1b6064820152608401610999565b6001600160a01b0383166128975760405162461bcd60e51b815260206004820152602360248201527f4552433732315073693a206d696e7420746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610999565b81600460008282546128a991906135ec565b9091555050600081815260036020526040812080546001600160a01b0319166001600160a01b0386161790556128df9082612041565b6128ec600084838561206d565b805b6128f883836135ec565b811015610e585760405181906001600160a01b038616906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46001016128ee565b600881901c60008181526020849052604081205490919060ff808516919082181c80156129815761296f81612a91565b60ff168203600884901b179350612a2e565b600083116129ee5760405162461bcd60e51b815260206004820152603460248201527f4269744d6170733a205468652073657420626974206265666f7265207468652060448201527334b73232bc103237b2b9b713ba1032bc34b9ba1760611b6064820152608401610999565b506000199091016000818152602086905260409020549091908015612a2957612a1681612a91565b60ff0360ff16600884901b179350612a2e565b612981565b50505092915050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610e58908590612afb565b6000604051806101200160405280610100815260200161391b610100913960f87e818283848586878898a8b8c8d8e8f929395969799a9b9d9e9faaeb6bedeeff612ada85612b5e565b02901c81518110612aed57612aed613597565b016020015160f81c92915050565b6000612b106001600160a01b03841683612b76565b90508051600014158015612b35575080806020019051810190612b3391906138e1565b155b15610ad057604051635274afe760e01b81526001600160a01b0384166004820152602401610999565b6000808211612b6c57600080fd5b5060008190031690565b60606127c38383600084600080856001600160a01b03168486604051612b9c91906138fe565b60006040518083038185875af1925050503d8060008114612bd9576040519150601f19603f3d011682016040523d82523d6000602084013e612bde565b606091505b5091509150612bee868383612bf8565b9695505050505050565b606082612c0d57612c0882612c54565b6127c3565b8151158015612c2457506001600160a01b0384163b155b15612c4d57604051639996b31560e01b81526001600160a01b0385166004820152602401610999565b50806127c3565b805115612c645780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60405180606001604052806000801916815260200160006001600160401b03168152602001612cbf604051806040016040528060008152602001600081525090565b905290565b6001600160e01b0319811681146113be57600080fd5b600060208284031215612cec57600080fd5b81356127c381612cc4565b60005b83811015612d12578181015183820152602001612cfa565b50506000910152565b60008151808452612d33816020860160208601612cf7565b601f01601f19169290920160200192915050565b6020815260006127c36020830184612d1b565b600060208284031215612d6c57600080fd5b5035919050565b6001600160a01b03811681146113be57600080fd5b60008060408385031215612d9b57600080fd5b8235612da681612d73565b946020939093013593505050565b600060608284031215612dc657600080fd5b50919050565b60008083601f840112612dde57600080fd5b5081356001600160401b03811115612df557600080fd5b602083019150836020828501011115610cd257600080fd5b600080600080600080600060e0888a031215612e2857600080fd5b612e328989612db4565b96506060880135955060808801356001600160401b0380821115612e5557600080fd5b612e618b838c01612dcc565b909750955060a08a01359150612e7682612d73565b90935060c08901359080821115612e8c57600080fd5b50612e998a828b01612dcc565b989b979a50959850939692959293505050565b600080600060608486031215612ec157600080fd5b8335612ecc81612d73565b92506020840135612edc81612d73565b929592945050506040919091013590565b803563ffffffff8116811461249357600080fd5b634e487b7160e01b600052604160045260246000fd5b600082601f830112612f2857600080fd5b81356001600160401b0380821115612f4257612f42612f01565b604051601f8301601f19908116603f01168101908282118183101715612f6a57612f6a612f01565b81604052838152866020858801011115612f8357600080fd5b836020870160208301376000602085830101528094505050505092915050565b80151581146113be57600080fd5b600080600080600060a08688031215612fc957600080fd5b612fd286612eed565b94506020860135612fe281612d73565b93506040860135925060608601356001600160401b0381111561300457600080fd5b61301088828901612f17565b925050608086013561302181612fa3565b809150509295509295909350565b815181526020808301519082015260408101610896565b6000806040838503121561305957600080fd5b50508035926020909101359150565b6000806040838503121561307b57600080fd5b82359150602083013561308d81612d73565b809150509250929050565b600080604083850312156130ab57600080fd5b612da683612eed565b600080602083850312156130c757600080fd5b82356001600160401b038111156130dd57600080fd5b6130e985828601612dcc565b90969095509350505050565b60006020828403121561310757600080fd5b81356127c381612d73565b60008060008060a0858703121561312857600080fd5b6131328686612db4565b935060608501356001600160401b0381111561314d57600080fd5b61315987828801612dcc565b909450925050608085013561316d81612d73565b939692955090935050565b6020808252825182820181905260009190848201906040850190845b818110156131b057835183529284019291840191600101613194565b50909695505050505050565b6000806000806000608086880312156131d457600080fd5b6131dd86612eed565b945060208601356131ed81612d73565b93506040860135925060608601356001600160401b0381111561320f57600080fd5b61321b88828901612dcc565b969995985093965092949392505050565b6000608082019050825182526001600160401b0360208401511660208301526040830151613267604084018280518252602090810151910152565b5092915050565b6000806040838503121561328157600080fd5b823561328c81612d73565b9150602083013561308d81612fa3565b600080600080608085870312156132b257600080fd5b84356132bd81612d73565b935060208501356132cd81612d73565b92506040850135915060608501356001600160401b038111156132ef57600080fd5b6132fb87828801612f17565b91505092959194509250565b60006020828403121561331957600080fd5b6127c382612eed565b6000806040838503121561333557600080fd5b823561334081612d73565b915060208301356001600160601b038116811461308d57600080fd5b6000806040838503121561336f57600080fd5b823561337a81612d73565b9150602083013561308d81612d73565b60006060828403121561339c57600080fd5b6127c38383612db4565b600181811c908216806133ba57607f821691505b602082108103612dc657634e487b7160e01b600052602260045260246000fd5b60208082526034908201527f4552433732315073693a207472616e736665722063616c6c6572206973206e6f6040820152731d081bdddb995c881b9bdc88185c1c1c9bdd995960621b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176108965761089661342e565b60008261347857634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156108965761089661342e565b601f821115610ad0576000816000526020600020601f850160051c810160208610156134b95750805b601f850160051c820191505b818110156118b3578281556001016134c5565b6001600160401b038311156134ef576134ef612f01565b613503836134fd83546133a6565b83613490565b6000601f841160018114613537576000851561351f5750838201355b600019600387901b1c1916600186901b1783556112f3565b600083815260209020601f19861690835b828110156135685786850135825560209485019460019092019101613548565b50868210156135855760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b634e487b7160e01b600052603260045260246000fd5b600083516135bf818460208801612cf7565b8351908301906135d3818360208801612cf7565b64173539b7b760d91b9101908152600501949350505050565b808201808211156108965761089661342e565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a0608084015261363560e0840182612d1b565b90506060850151603f198483030160a08501526136528282612d1b565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b60006040828403121561368a57600080fd5b604051604081018181106001600160401b03821117156136ac576136ac612f01565b604052825181526020928301519281019290925250919050565b6000604082840312156136d857600080fd5b6127c38383613678565b6000608082840312156136f457600080fd5b604051606081016001600160401b03828210818311171561371757613717612f01565b816040528451835260208501519150808216821461373457600080fd5b5060208201526137478460408501613678565b60408201529392505050565b60208082526035908201527f4552433732315073693a207472616e7366657220746f206e6f6e20455243373260408201527418a932b1b2b4bb32b91034b6b83632b6b2b73a32b960591b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516137e0816017850160208801612cf7565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613811816028840160208801612cf7565b01602801949350505050565b60006020828403121561382f57600080fd5b81516127c381612d73565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090612bee90830184612d1b565b60006020828403121561387f57600080fd5b81516127c381612cc4565b6001600160401b038281168282160390808211156132675761326761342e565b6001600160401b038181168382160190808211156132675761326761342e565b6000816138d9576138d961342e565b506000190190565b6000602082840312156138f357600080fd5b81516127c381612fa3565b60008251613910818460208701612cf7565b919091019291505056fe0001020903110a19042112290b311a3905412245134d2a550c5d32651b6d3a7506264262237d468514804e8d2b95569d0d495ea533a966b11c886eb93bc176c9071727374353637324837e9b47af86c7155181ad4fd18ed32c9096db57d59ee30e2e4a6a5f92a6be3498aae067ddb2eb1d5989b56fd7baf33ca0c2ee77e5caf7ff0810182028303840444c545c646c7425617c847f8c949c48a4a8b087b8c0c816365272829aaec650acd0d28fdad4e22d6991bd97dfdcea58b4d6f29fede4f6fe0f1f2f3f4b5b6b607b8b93a3a7b7bf357199c5abcfd9e168bcdee9b3f1ecf5fd1e3e5a7a8aa2b670c4ced8bbe8f0f4fc3d79a1c3cde7effb78cce6facbf9f8a26469706673582212204b5aca314fdbbb975660012d7bfaa2f0fbc7745f9cffdb9993a514a394007dd264736f6c634300081800339f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6a264697066735822122052820dd1e572389a61bc043dee382adfc10443e5c779d45b7def0ff121fbb87764736f6c63430008180033