creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/access/AccessControl.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```solidity\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```solidity\n * function foo() public {\n *     require(hasRole(MY_ROLE, msg.sender));\n *     ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}\n * to enforce additional security measures for this role.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n    struct RoleData {\n        mapping(address => bool) members;\n        bytes32 adminRole;\n    }\n\n    mapping(bytes32 => RoleData) private _roles;\n\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n    /**\n     * @dev Modifier that checks that an account has a specific role. Reverts\n     * with a standardized message including the required role.\n     *\n     * The format of the revert reason is given by the following regular expression:\n     *\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n     *\n     * _Available since v4.1._\n     */\n    modifier onlyRole(bytes32 role) {\n        _checkRole(role);\n        _;\n    }\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n        return _roles[role].members[account];\n    }\n\n    /**\n     * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n     * Overriding this function changes the behavior of the {onlyRole} modifier.\n     *\n     * Format of the revert message is described in {_checkRole}.\n     *\n     * _Available since v4.6._\n     */\n    function _checkRole(bytes32 role) internal view virtual {\n        _checkRole(role, _msgSender());\n    }\n\n    /**\n     * @dev Revert with a standard message if `account` is missing `role`.\n     *\n     * The format of the revert reason is given by the following regular expression:\n     *\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n     */\n    function _checkRole(bytes32 role, address account) internal view virtual {\n        if (!hasRole(role, account)) {\n            revert(\n                string(\n                    abi.encodePacked(\n                        \"AccessControl: account \",\n                        Strings.toHexString(account),\n                        \" is missing role \",\n                        Strings.toHexString(uint256(role), 32)\n                    )\n                )\n            );\n        }\n    }\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n        return _roles[role].adminRole;\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been revoked `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function renounceRole(bytes32 role, address account) public virtual override {\n        require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event. Note that unlike {grantRole}, this function doesn't perform any\n     * checks on the calling account.\n     *\n     * May emit a {RoleGranted} event.\n     *\n     * [WARNING]\n     * ====\n     * This function should only be called from the constructor when setting\n     * up the initial roles for the system.\n     *\n     * Using this function in any other way is effectively circumventing the admin\n     * system imposed by {AccessControl}.\n     * ====\n     *\n     * NOTE: This function is deprecated in favor of {_grantRole}.\n     */\n    function _setupRole(bytes32 role, address account) internal virtual {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Sets `adminRole` as ``role``'s admin role.\n     *\n     * Emits a {RoleAdminChanged} event.\n     */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n        bytes32 previousAdminRole = getRoleAdmin(role);\n        _roles[role].adminRole = adminRole;\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleGranted} event.\n     */\n    function _grantRole(bytes32 role, address account) internal virtual {\n        if (!hasRole(role, account)) {\n            _roles[role].members[account] = true;\n            emit RoleGranted(role, account, _msgSender());\n        }\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * Internal function without access restriction.\n     *\n     * May emit a {RoleRevoked} event.\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual {\n        if (hasRole(role, account)) {\n            _roles[role].members[account] = false;\n            emit RoleRevoked(role, account, _msgSender());\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/access/IAccessControl.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted signaling this.\n     *\n     * _Available since v3.1._\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call, an admin role\n     * bearer except when using {AccessControl-_setupRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     */\n    function renounceRole(bytes32 role, address account) external;\n}\n"
      },
      "@openzeppelin/contracts/interfaces/IERC5267.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)\n\npragma solidity ^0.8.0;\n\ninterface IERC5267 {\n    /**\n     * @dev MAY be emitted to signal that the domain could have changed.\n     */\n    event EIP712DomainChanged();\n\n    /**\n     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712\n     * signature.\n     */\n    function eip712Domain()\n        external\n        view\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        );\n}\n"
      },
      "@openzeppelin/contracts/proxy/Clones.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/Clones.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for\n * deploying minimal proxy contracts, also known as \"clones\".\n *\n * > To simply and cheaply clone contract functionality in an immutable way, this standard specifies\n * > a minimal bytecode implementation that delegates all calls to a known, fixed address.\n *\n * The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`\n * (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the\n * deterministic method.\n *\n * _Available since v3.4._\n */\nlibrary Clones {\n    /**\n     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n     *\n     * This function uses the create opcode, which should never revert.\n     */\n    function clone(address implementation) internal returns (address instance) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n            // of the `implementation` address with the bytecode before the address.\n            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n            instance := create(0, 0x09, 0x37)\n        }\n        require(instance != address(0), \"ERC1167: create failed\");\n    }\n\n    /**\n     * @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.\n     *\n     * This function uses the create2 opcode and a `salt` to deterministically deploy\n     * the clone. Using the same `implementation` and `salt` multiple time will revert, since\n     * the clones cannot be deployed twice at the same address.\n     */\n    function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            // Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes\n            // of the `implementation` address with the bytecode before the address.\n            mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))\n            // Packs the remaining 17 bytes of `implementation` with the bytecode after the address.\n            mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))\n            instance := create2(0, 0x09, 0x37, salt)\n        }\n        require(instance != address(0), \"ERC1167: create2 failed\");\n    }\n\n    /**\n     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n     */\n    function predictDeterministicAddress(\n        address implementation,\n        bytes32 salt,\n        address deployer\n    ) internal pure returns (address predicted) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40)\n            mstore(add(ptr, 0x38), deployer)\n            mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)\n            mstore(add(ptr, 0x14), implementation)\n            mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)\n            mstore(add(ptr, 0x58), salt)\n            mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))\n            predicted := keccak256(add(ptr, 0x43), 0x55)\n        }\n    }\n\n    /**\n     * @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.\n     */\n    function predictDeterministicAddress(\n        address implementation,\n        bytes32 salt\n    ) internal view returns (address predicted) {\n        return predictDeterministicAddress(implementation, salt, address(this));\n    }\n}\n"
      },
      "@openzeppelin/contracts/security/Pausable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n    /**\n     * @dev Emitted when the pause is triggered by `account`.\n     */\n    event Paused(address account);\n\n    /**\n     * @dev Emitted when the pause is lifted by `account`.\n     */\n    event Unpaused(address account);\n\n    bool private _paused;\n\n    /**\n     * @dev Initializes the contract in unpaused state.\n     */\n    constructor() {\n        _paused = false;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is not paused.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    modifier whenNotPaused() {\n        _requireNotPaused();\n        _;\n    }\n\n    /**\n     * @dev Modifier to make a function callable only when the contract is paused.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    modifier whenPaused() {\n        _requirePaused();\n        _;\n    }\n\n    /**\n     * @dev Returns true if the contract is paused, and false otherwise.\n     */\n    function paused() public view virtual returns (bool) {\n        return _paused;\n    }\n\n    /**\n     * @dev Throws if the contract is paused.\n     */\n    function _requireNotPaused() internal view virtual {\n        require(!paused(), \"Pausable: paused\");\n    }\n\n    /**\n     * @dev Throws if the contract is not paused.\n     */\n    function _requirePaused() internal view virtual {\n        require(paused(), \"Pausable: not paused\");\n    }\n\n    /**\n     * @dev Triggers stopped state.\n     *\n     * Requirements:\n     *\n     * - The contract must not be paused.\n     */\n    function _pause() internal virtual whenNotPaused {\n        _paused = true;\n        emit Paused(_msgSender());\n    }\n\n    /**\n     * @dev Returns to normal state.\n     *\n     * Requirements:\n     *\n     * - The contract must be paused.\n     */\n    function _unpause() internal virtual whenPaused {\n        _paused = false;\n        emit Unpaused(_msgSender());\n    }\n}\n"
      },
      "@openzeppelin/contracts/security/ReentrancyGuard.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n    // Booleans are more expensive than uint256 or any type that takes up a full\n    // word because each write operation emits an extra SLOAD to first read the\n    // slot's contents, replace the bits taken up by the boolean, and then write\n    // back. This is the compiler's defense against contract upgrades and\n    // pointer aliasing, and it cannot be disabled.\n\n    // The values being non-zero value makes deployment a bit more expensive,\n    // but in exchange the refund on every call to nonReentrant will be lower in\n    // amount. Since refunds are capped to a percentage of the total\n    // transaction's gas, it is best to keep them low in cases like this one, to\n    // increase the likelihood of the full refund coming into effect.\n    uint256 private constant _NOT_ENTERED = 1;\n    uint256 private constant _ENTERED = 2;\n\n    uint256 private _status;\n\n    constructor() {\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Prevents a contract from calling itself, directly or indirectly.\n     * Calling a `nonReentrant` function from another `nonReentrant`\n     * function is not supported. It is possible to prevent this from happening\n     * by making the `nonReentrant` function external, and making it call a\n     * `private` function that does the actual work.\n     */\n    modifier nonReentrant() {\n        _nonReentrantBefore();\n        _;\n        _nonReentrantAfter();\n    }\n\n    function _nonReentrantBefore() private {\n        // On the first call to nonReentrant, _status will be _NOT_ENTERED\n        require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n        // Any calls to nonReentrant after this point will fail\n        _status = _ENTERED;\n    }\n\n    function _nonReentrantAfter() private {\n        // By storing the original value once again, a refund is triggered (see\n        // https://eips.ethereum.org/EIPS/eip-2200)\n        _status = _NOT_ENTERED;\n    }\n\n    /**\n     * @dev Returns true if the reentrancy guard is currently set to \"entered\", which indicates there is a\n     * `nonReentrant` function in the call stack.\n     */\n    function _reentrancyGuardEntered() internal view returns (bool) {\n        return _status == _ENTERED;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     *\n     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS,\n        InvalidSignatureV // Deprecated in v4.8\n    }\n\n    function _throwError(RecoverError error) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert(\"ECDSA: invalid signature\");\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert(\"ECDSA: invalid signature length\");\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert(\"ECDSA: invalid signature 's' value\");\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature` or error string. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            /// @solidity memory-safe-assembly\n            assembly {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength);\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, signature);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) {\n        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n        uint8 v = uint8((uint256(vs) >> 255) + 27);\n        return tryRecover(hash, v, r, s);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     *\n     * _Available since v4.2._\n     */\n    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature);\n        }\n\n        return (signer, RecoverError.NoError);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {\n        // 32 is the length in bytes of hash,\n        // enforced by the type signature above\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x00, \"\\x19Ethereum Signed Message:\\n32\")\n            mstore(0x1c, hash)\n            message := keccak256(0x00, 0x3c)\n        }\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from `s`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Typed Data, created from a\n     * `domainSeparator` and a `structHash`. This produces hash corresponding\n     * to the one signed with the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n     * JSON-RPC method as part of EIP-712.\n     *\n     * See {recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            let ptr := mload(0x40)\n            mstore(ptr, \"\\x19\\x01\")\n            mstore(add(ptr, 0x02), domainSeparator)\n            mstore(add(ptr, 0x22), structHash)\n            data := keccak256(ptr, 0x42)\n        }\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Data with intended validator, created from a\n     * `validator` and `data` according to the version 0 of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19\\x00\", validator, data));\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/cryptography/EIP712.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./ECDSA.sol\";\nimport \"../ShortStrings.sol\";\nimport \"../../interfaces/IERC5267.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain\n * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the\n * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.\n *\n * _Available since v3.4._\n *\n * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n */\nabstract contract EIP712 is IERC5267 {\n    using ShortStrings for *;\n\n    bytes32 private constant _TYPE_HASH =\n        keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n    // invalidate the cached domain separator if the chain id changes.\n    bytes32 private immutable _cachedDomainSeparator;\n    uint256 private immutable _cachedChainId;\n    address private immutable _cachedThis;\n\n    bytes32 private immutable _hashedName;\n    bytes32 private immutable _hashedVersion;\n\n    ShortString private immutable _name;\n    ShortString private immutable _version;\n    string private _nameFallback;\n    string private _versionFallback;\n\n    /**\n     * @dev Initializes the domain separator and parameter caches.\n     *\n     * The meaning of `name` and `version` is specified in\n     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n     *\n     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n     * - `version`: the current major version of the signing domain.\n     *\n     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n     * contract upgrade].\n     */\n    constructor(string memory name, string memory version) {\n        _name = name.toShortStringWithFallback(_nameFallback);\n        _version = version.toShortStringWithFallback(_versionFallback);\n        _hashedName = keccak256(bytes(name));\n        _hashedVersion = keccak256(bytes(version));\n\n        _cachedChainId = block.chainid;\n        _cachedDomainSeparator = _buildDomainSeparator();\n        _cachedThis = address(this);\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {\n            return _cachedDomainSeparator;\n        } else {\n            return _buildDomainSeparator();\n        }\n    }\n\n    function _buildDomainSeparator() private view returns (bytes32) {\n        return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));\n    }\n\n    /**\n     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n     * function returns the hash of the fully encoded EIP712 message for this domain.\n     *\n     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n     *\n     * ```solidity\n     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n     *     keccak256(\"Mail(address to,string contents)\"),\n     *     mailTo,\n     *     keccak256(bytes(mailContents))\n     * )));\n     * address signer = ECDSA.recover(digest, signature);\n     * ```\n     */\n    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n\n    /**\n     * @dev See {EIP-5267}.\n     *\n     * _Available since v4.9._\n     */\n    function eip712Domain()\n        public\n        view\n        virtual\n        override\n        returns (\n            bytes1 fields,\n            string memory name,\n            string memory version,\n            uint256 chainId,\n            address verifyingContract,\n            bytes32 salt,\n            uint256[] memory extensions\n        )\n    {\n        return (\n            hex\"0f\", // 01111\n            _name.toStringWithFallback(_nameFallback),\n            _version.toStringWithFallback(_versionFallback),\n            block.chainid,\n            address(this),\n            bytes32(0),\n            new uint256[](0)\n        );\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/introspection/ERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/utils/math/Math.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Down, // Toward negative infinity\n        Up, // Toward infinity\n        Zero // Toward zero\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds up instead\n     * of rounding down.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n     * with further edits by Uniswap Labs also under MIT license.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod0 := mul(x, y)\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                // Solidity will revert if denominator == 0, unlike the div opcode on its own.\n                // The surrounding unchecked block does not change this fact.\n                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1, \"Math: mulDiv overflow\");\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n            // See https://cs.stackexchange.com/q/138556/92363.\n\n            // Does not overflow because the denominator cannot be zero at this stage in the function.\n            uint256 twos = denominator & (~denominator + 1);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n            // in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        //\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n        //\n        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n        //\n        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1 << (log2(a) >> 1);\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = sqrt(a);\n            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 2, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 128;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 64;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 32;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 16;\n            }\n            if (value >> 8 > 0) {\n                value >>= 8;\n                result += 8;\n            }\n            if (value >> 4 > 0) {\n                value >>= 4;\n                result += 4;\n            }\n            if (value >> 2 > 0) {\n                value >>= 2;\n                result += 2;\n            }\n            if (value >> 1 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log2(value);\n            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 10, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >= 10 ** 64) {\n                value /= 10 ** 64;\n                result += 64;\n            }\n            if (value >= 10 ** 32) {\n                value /= 10 ** 32;\n                result += 32;\n            }\n            if (value >= 10 ** 16) {\n                value /= 10 ** 16;\n                result += 16;\n            }\n            if (value >= 10 ** 8) {\n                value /= 10 ** 8;\n                result += 8;\n            }\n            if (value >= 10 ** 4) {\n                value /= 10 ** 4;\n                result += 4;\n            }\n            if (value >= 10 ** 2) {\n                value /= 10 ** 2;\n                result += 2;\n            }\n            if (value >= 10 ** 1) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log10(value);\n            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);\n        }\n    }\n\n    /**\n     * @dev Return the log in base 256, rounded down, of a positive value.\n     * Returns 0 if given 0.\n     *\n     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n     */\n    function log256(uint256 value) internal pure returns (uint256) {\n        uint256 result = 0;\n        unchecked {\n            if (value >> 128 > 0) {\n                value >>= 128;\n                result += 16;\n            }\n            if (value >> 64 > 0) {\n                value >>= 64;\n                result += 8;\n            }\n            if (value >> 32 > 0) {\n                value >>= 32;\n                result += 4;\n            }\n            if (value >> 16 > 0) {\n                value >>= 16;\n                result += 2;\n            }\n            if (value >> 8 > 0) {\n                result += 1;\n            }\n        }\n        return result;\n    }\n\n    /**\n     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.\n     * Returns 0 if given 0.\n     */\n    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n        unchecked {\n            uint256 result = log256(value);\n            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/math/SignedMath.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard signed math utilities missing in the Solidity language.\n */\nlibrary SignedMath {\n    /**\n     * @dev Returns the largest of two signed numbers.\n     */\n    function max(int256 a, int256 b) internal pure returns (int256) {\n        return a > b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two signed numbers.\n     */\n    function min(int256 a, int256 b) internal pure returns (int256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two signed numbers without overflow.\n     * The result is rounded towards zero.\n     */\n    function average(int256 a, int256 b) internal pure returns (int256) {\n        // Formula from the book \"Hacker's Delight\"\n        int256 x = (a & b) + ((a ^ b) >> 1);\n        return x + (int256(uint256(x) >> 255) & (a ^ b));\n    }\n\n    /**\n     * @dev Returns the absolute unsigned value of a signed value.\n     */\n    function abs(int256 n) internal pure returns (uint256) {\n        unchecked {\n            // must be unchecked in order to support `n = type(int256).min`\n            return uint256(n >= 0 ? n : -n);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/ShortStrings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)\n\npragma solidity ^0.8.8;\n\nimport \"./StorageSlot.sol\";\n\n// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |\n// | length  | 0x                                                              BB |\ntype ShortString is bytes32;\n\n/**\n * @dev This library provides functions to convert short memory strings\n * into a `ShortString` type that can be used as an immutable variable.\n *\n * Strings of arbitrary length can be optimized using this library if\n * they are short enough (up to 31 bytes) by packing them with their\n * length (1 byte) in a single EVM word (32 bytes). Additionally, a\n * fallback mechanism can be used for every other case.\n *\n * Usage example:\n *\n * ```solidity\n * contract Named {\n *     using ShortStrings for *;\n *\n *     ShortString private immutable _name;\n *     string private _nameFallback;\n *\n *     constructor(string memory contractName) {\n *         _name = contractName.toShortStringWithFallback(_nameFallback);\n *     }\n *\n *     function name() external view returns (string memory) {\n *         return _name.toStringWithFallback(_nameFallback);\n *     }\n * }\n * ```\n */\nlibrary ShortStrings {\n    // Used as an identifier for strings longer than 31 bytes.\n    bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;\n\n    error StringTooLong(string str);\n    error InvalidShortString();\n\n    /**\n     * @dev Encode a string of at most 31 chars into a `ShortString`.\n     *\n     * This will trigger a `StringTooLong` error is the input string is too long.\n     */\n    function toShortString(string memory str) internal pure returns (ShortString) {\n        bytes memory bstr = bytes(str);\n        if (bstr.length > 31) {\n            revert StringTooLong(str);\n        }\n        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));\n    }\n\n    /**\n     * @dev Decode a `ShortString` back to a \"normal\" string.\n     */\n    function toString(ShortString sstr) internal pure returns (string memory) {\n        uint256 len = byteLength(sstr);\n        // using `new string(len)` would work locally but is not memory safe.\n        string memory str = new string(32);\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(str, len)\n            mstore(add(str, 0x20), sstr)\n        }\n        return str;\n    }\n\n    /**\n     * @dev Return the length of a `ShortString`.\n     */\n    function byteLength(ShortString sstr) internal pure returns (uint256) {\n        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;\n        if (result > 31) {\n            revert InvalidShortString();\n        }\n        return result;\n    }\n\n    /**\n     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.\n     */\n    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {\n        if (bytes(value).length < 32) {\n            return toShortString(value);\n        } else {\n            StorageSlot.getStringSlot(store).value = value;\n            return ShortString.wrap(_FALLBACK_SENTINEL);\n        }\n    }\n\n    /**\n     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n     */\n    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {\n        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\n            return toString(value);\n        } else {\n            return store;\n        }\n    }\n\n    /**\n     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.\n     *\n     * WARNING: This will return the \"byte length\" of the string. This may not reflect the actual length in terms of\n     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.\n     */\n    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {\n        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {\n            return byteLength(value);\n        } else {\n            return bytes(store).length;\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/StorageSlot.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)\n// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```solidity\n * contract ERC1967 {\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._\n * _Available since v4.9 for `string`, `bytes`._\n */\nlibrary StorageSlot {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    struct StringSlot {\n        string value;\n    }\n\n    struct BytesSlot {\n        bytes value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` with member `value` located at `slot`.\n     */\n    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.\n     */\n    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` with member `value` located at `slot`.\n     */\n    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.\n     */\n    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := store.slot\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/Math.sol\";\nimport \"./math/SignedMath.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n    uint8 private constant _ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            uint256 length = Math.log10(value) + 1;\n            string memory buffer = new string(length);\n            uint256 ptr;\n            /// @solidity memory-safe-assembly\n            assembly {\n                ptr := add(buffer, add(32, length))\n            }\n            while (true) {\n                ptr--;\n                /// @solidity memory-safe-assembly\n                assembly {\n                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n                }\n                value /= 10;\n                if (value == 0) break;\n            }\n            return buffer;\n        }\n    }\n\n    /**\n     * @dev Converts a `int256` to its ASCII `string` decimal representation.\n     */\n    function toString(int256 value) internal pure returns (string memory) {\n        return string(abi.encodePacked(value < 0 ? \"-\" : \"\", toString(SignedMath.abs(value))));\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, Math.log256(value) + 1);\n        }\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = _SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n    }\n\n    /**\n     * @dev Returns true if the two strings are equal.\n     */\n    function equal(string memory a, string memory b) internal pure returns (bool) {\n        return keccak256(bytes(a)) == keccak256(bytes(b));\n    }\n}\n"
      },
      "contracts/AdminPrivileges.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\n// Copyright 2023 Enjinstarter\npragma solidity 0.8.19;\n\nimport {AccessControl} from \"@openzeppelin/contracts/access/AccessControl.sol\";\nimport {IAdminPrivileges} from \"./interfaces/IAdminPrivileges.sol\";\n\n/**\n * @title AdminPrivileges\n * @author Tim Loh\n * @notice Provides admin privileges role definitions that are inherited by other contracts\n */\ncontract AdminPrivileges is AccessControl, IAdminPrivileges {\n    bytes32 public constant BACKOFFICE_ROLE_ADMIN_ROLE = keccak256(\"BACKOFFICE_ROLE_ADMIN_ROLE\");\n    bytes32 public constant BACKOFFICE_GOVERNANCE_ROLE = keccak256(\"BACKOFFICE_GOVERNANCE_ROLE\");\n    bytes32 public constant BACKOFFICE_CONTRACT_ADMIN_ROLE = keccak256(\"BACKOFFICE_CONTRACT_ADMIN_ROLE\");\n\n    bytes32 public constant TENANT_ROLE_ADMIN_ROLE = keccak256(\"TENANT_ROLE_ADMIN_ROLE\");\n    bytes32 public constant TENANT_GOVERNANCE_ROLE = keccak256(\"TENANT_GOVERNANCE_ROLE\");\n    bytes32 public constant TENANT_CONTRACT_ADMIN_ROLE = keccak256(\"TENANT_CONTRACT_ADMIN_ROLE\");\n}\n"
      },
      "contracts/interfaces/IAdminPrivileges.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\n// Copyright 2023 Enjinstarter\npragma solidity 0.8.19;\n\n/**\n * @title AdminPrivileges Interface\n * @author Tim Loh\n * @notice Interface for admin privileges role definitions that are inherited by other contracts\n */\ninterface IAdminPrivileges {\n    // solhint-disable func-name-mixedcase\n\n    // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions\n    // slither-disable-next-line naming-convention\n    function BACKOFFICE_ROLE_ADMIN_ROLE() external view returns (bytes32);\n\n    // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions\n    // slither-disable-next-line naming-convention\n    function BACKOFFICE_GOVERNANCE_ROLE() external view returns (bytes32);\n\n    // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions\n    // slither-disable-next-line naming-convention\n    function BACKOFFICE_CONTRACT_ADMIN_ROLE() external view returns (bytes32);\n\n    // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions\n    // slither-disable-next-line naming-convention\n    function TENANT_ROLE_ADMIN_ROLE() external view returns (bytes32);\n\n    // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions\n    // slither-disable-next-line naming-convention\n    function TENANT_GOVERNANCE_ROLE() external view returns (bytes32);\n\n    // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions\n    // slither-disable-next-line naming-convention\n    function TENANT_CONTRACT_ADMIN_ROLE() external view returns (bytes32);\n\n    // solhint-enable func-name-mixedcase\n}\n"
      },
      "contracts/interfaces/IAdminWallet.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\n// Copyright 2023 Enjinstarter\npragma solidity 0.8.19;\n\n/**\n * @title AdminWallet Interface\n * @author Tim Loh\n * @notice Interface for admin wallet that will receive the funds\n */\ninterface IAdminWallet {\n    /**\n     * @notice Emitted when admin wallet has been changed from `oldWallet` to `newWallet`\n     * @param oldWallet The wallet before the wallet was changed\n     * @param newWallet The wallet after the wallet was changed\n     * @param sender The address that changes the admin wallet\n     */\n    event AdminWalletChanged(address indexed oldWallet, address indexed newWallet, address indexed sender);\n\n    /**\n     * @notice Returns the admin wallet address that will receive the funds\n     * @return Admin wallet address\n     */\n    function adminWallet() external view returns (address);\n}\n"
      },
      "contracts/interfaces/IFactoryImplementation.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\n// Copyright 2023 Enjinstarter\npragma solidity 0.8.19;\n\n/**\n * @title IFactoryImplementation\n * @author Tim Loh\n * @notice Provides factory implementation type that is inherited by reference implementation contracts for matching\n *         with corresponding factory contracts\n */\ninterface IFactoryImplementation {\n    function factoryImplementationType() external view returns (uint256);\n}\n"
      },
      "contracts/interfaces/ISubscriptionService.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\n// Copyright 2023 Enjinstarter\npragma solidity 0.8.19;\n\nimport {IAccessControl} from \"@openzeppelin/contracts/access/IAccessControl.sol\";\nimport {IAdminPrivileges} from \"./IAdminPrivileges.sol\";\nimport {IAdminWallet} from \"./IAdminWallet.sol\";\n\n/**\n * @title ISubscriptionService\n * @author Tim Loh\n */\ninterface ISubscriptionService is IAccessControl, IAdminPrivileges, IAdminWallet {\n    /**\n     * @notice Emitted when subscription package available for purchase has been setup\n     * @param subscriptionId The subscription identifier\n     * @param sender The address with backoffice contract admin role that setup the subscription package for purchase\n     * @param paymentTokenAddress The address of the token that will be used for payment\n     * @param paymentTokenDecimals The number of decimals for the payment token\n     * @param priceInPaymentTokenWei The amount in wei of payment tokens to pay for subscription package\n     * @param expiryDays The number of days after purchase when subscription package expires\n     * @param numberOfContracts The additional number of contracts that can be deployed after purchase\n     */\n    event AvailableSubscriptionPackageSet(\n        bytes32 indexed subscriptionId,\n        address indexed sender,\n        address indexed paymentTokenAddress,\n        uint256 paymentTokenDecimals,\n        uint256 priceInPaymentTokenWei,\n        uint256 expiryDays,\n        uint256 numberOfContracts\n    );\n\n    /**\n     * @notice Emitted when `purchaserAddress` is added as purchaser of specified subscription\n     * @param subscriptionId The subscription identifier\n     * @param purchaserAddress The address to be added as purchaser of specified subscription\n     * @param sender The address with backoffice contract admin role that added the address as purchaser\n     */\n    event PurchaserAddressAdded(\n        bytes32 indexed subscriptionId,\n        address indexed purchaserAddress,\n        address indexed sender\n    );\n\n    /**\n     * @notice Emitted when `purchaserAddress` is removed as purchaser of specified subscription.\n     * @param subscriptionId The subscription identifier\n     * @param purchaserAddress The address to be removed as purchaser of specified subscription\n     * @param sender The address with backoffice contract admin role that removed the address as purchaser\n     */\n    event PurchaserAddressRemoved(\n        bytes32 indexed subscriptionId,\n        address indexed purchaserAddress,\n        address indexed sender\n    );\n\n    /**\n     * @notice Emitted when purchased subscription package has been consumed by `account` to deploy a contract\n     * @param subscriptionId The subscription identifier\n     * @param sender The address with contract usage role that initiated the subscription package consumption by\n     *               `account`\n     * @param account The address that consumed the subscription package to deploy a contract\n     * @param numberOfContractsDeployed The number of contracts deployed after consuming subscription package\n     * @param numberOfDeployableContracts The number of deployable contracts after consuming subscription package\n     * @param expiryTimestamp The timestamp when purchased subscription package expires\n     */\n    event SubscriptionPackageConsumed(\n        bytes32 indexed subscriptionId,\n        address indexed sender,\n        address indexed account,\n        uint256 numberOfContractsDeployed,\n        uint256 numberOfDeployableContracts,\n        uint256 expiryTimestamp\n    );\n\n    /**\n     * @notice Emitted when available subscription package has been purchased by `account`\n     * @param subscriptionId The subscription identifier\n     * @param sender The address that purchased the available subscription package\n     * @param paymentTokenAddress The address of the token that is used for payment\n     * @param paymentTokenDecimals The number of decimals for the payment token\n     * @param priceInPaymentTokenWei The amount in wei of payment tokens paid for subscription package\n     * @param availablePackageNumberOfContracts The additional number of contracts that can be deployed after purchase\n     * @param availablePackageExpiryDays The number of days after purchase when subscription package expires\n     * @param numberOfDeployableContracts The number of deployable contracts after purchase\n     * @param purchaseExpiryTimestamp The timestamp when purchased subscription package expires\n     * @param adminWallet The address receiving the payment tokens paid\n     */\n    event SubscriptionPackagePurchased(\n        bytes32 indexed subscriptionId,\n        address indexed sender,\n        address indexed paymentTokenAddress,\n        uint256 paymentTokenDecimals,\n        uint256 priceInPaymentTokenWei,\n        uint256 availablePackageNumberOfContracts,\n        uint256 availablePackageExpiryDays,\n        uint256 numberOfDeployableContracts,\n        uint256 purchaseExpiryTimestamp,\n        address adminWallet\n    );\n\n    /**\n     * @notice Add `purchaserAddress` as purchaser of subscription package so that can purchase or consume subscription\n     * @dev Must be called by backoffice contract admin role\n     * @param subscriptionId The subscription identifier\n     * @param purchaserAddress The address to be added as purchaser of specified subscription\n     */\n    function addPurchaserAddress(bytes32 subscriptionId, address purchaserAddress) external;\n\n    /**\n     * @notice Consume subscription package to deploy a contract\n     * @dev Must be called by contract usage role\n     * @dev Can only be consumed if `account` is purchaser of subscription package\n     * @param subscriptionId The subscription identifier\n     * @param account The address that will consume the subscription package to deploy a contract\n     * @return isConsumed `true` if subscription package has been consumed successfully\n     */\n    function consumeSubscriptionPackage(bytes32 subscriptionId, address account) external returns (bool isConsumed);\n\n    /**\n     * @notice Purchase subscription package by sender using ERC20 token for payment\n     * @dev Can only be purchased if sender is purchaser of subscription package\n     * @param subscriptionId The subscription identifier\n     */\n    function erc20PurchaseSubscriptionPackage(bytes32 subscriptionId) external;\n\n    /**\n     * @notice Purchase subscription package by sender using native token for payment\n     * @dev Can only be purchased if sender is purchaser of subscription package\n     * @param subscriptionId The subscription identifier\n     */\n    function nativePurchaseSubscriptionPackage(bytes32 subscriptionId) external payable;\n\n    /**\n     * @notice Pause user functions\n     * @dev Must be called by backoffice contract admin role\n     */\n    function pauseContract() external;\n\n    /**\n     * @notice Remove `purchaserAddress` as purchaser of subscription package\n     * @dev Must be called by backoffice contract admin role\n     * @param subscriptionId The subscription identifier\n     * @param purchaserAddress The address to be removed as purchaser of specified subscription\n     */\n    function removePurchaserAddress(bytes32 subscriptionId, address purchaserAddress) external;\n\n    /**\n     * @notice Change admin wallet that will receive funds to a new wallet address\n     * @dev Must be called by backoffice governance role\n     * @param newWallet The new admin wallet\n     */\n    function setAdminWallet(address newWallet) external;\n\n    /**\n     * @notice Setup subscription package that will be available for purchase\n     * @dev Must be called by backoffice contract admin role\n     * @dev Will auto purchase for zero cost subscription package\n     * @param subscriptionId The subscription identifier\n     * @param expiryDays The number of days after purchase when subscription package expires\n     * @param numberOfContracts The additional number of contracts that can be deployed after purchase\n     * @param paymentTokenAddress The address of the token that will be used for payment\n     * @param paymentTokenDecimals The number of decimals for the payment token\n     * @param priceInPaymentTokenWei The amount in wei of payment tokens to pay for subscription package\n     */\n    function setAvailableSubscriptionPackage(\n        bytes32 subscriptionId,\n        uint256 expiryDays,\n        uint256 numberOfContracts,\n        address paymentTokenAddress,\n        uint256 paymentTokenDecimals,\n        uint256 priceInPaymentTokenWei\n    ) external;\n\n    /**\n     * @notice Unpause user functions\n     * @dev Must be called by backoffice contract admin role\n     */\n    function unpauseContract() external;\n\n    /**\n     * @notice Get info of subscription package available for purchase\n     * @param subscriptionId The subscription identifier\n     * @return expiryDays The number of days after purchase when subscription package expires\n     * @return numberOfContracts The additional number of contracts that can be deployed after purchase\n     * @return paymentTokenAddress The address of the token that will be used for payment\n     * @return paymentTokenDecimals The number of decimals for the payment token\n     * @return priceInPaymentTokenWei The amount in wei of payment tokens to pay for subscription package\n     * @return isInitialized `true` if package is available for purchase\n     */\n    function getAvailableSubscriptionPackageFor(\n        bytes32 subscriptionId\n    )\n        external\n        view\n        returns (\n            uint256 expiryDays,\n            uint256 numberOfContracts,\n            address paymentTokenAddress,\n            uint256 paymentTokenDecimals,\n            uint256 priceInPaymentTokenWei,\n            bool isInitialized\n        );\n\n    /**\n     * @notice Get info of purchased subscription package\n     * @param subscriptionId The subscription identifier\n     * @return expiryTimestamp The timestamp when purchased subscription package expires\n     * @return numberOfContractsDeployed The number of contracts that have been deployed\n     * @return numberOfDeployableContracts The number of contracts that can be deployed\n     */\n    function getPurchasedSubscriptionPackageFor(\n        bytes32 subscriptionId\n    )\n        external\n        view\n        returns (uint256 expiryTimestamp, uint256 numberOfContractsDeployed, uint256 numberOfDeployableContracts);\n\n    /**\n     * @notice Checks whether `purchaserAddress` is allowed to purchase specified subscription package\n     * @param subscriptionId The subscription identifier\n     * @param purchaserAddress The address to check\n     * @return Returns `true` if `purchaserAddress` is allowed to purchase specified subscription package\n     */\n    function isAllowedToPurchase(bytes32 subscriptionId, address purchaserAddress) external view returns (bool);\n\n    /**\n     * @notice Checks whether this contract implements the interface defined by `interfaceId`\n     * @dev ERC165\n     * @return `true` if this contract implements the interface defined by `interfaceId`\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n\n    // solhint-disable func-name-mixedcase\n\n    /**\n     * @notice Get contract usage role definition\n     * @return Returns contract usage role definition\n     */\n    // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions\n    // slither-disable-next-line naming-convention\n    function CONTRACT_USAGE_ROLE() external view returns (bytes32);\n\n    /**\n     * @notice Get interface ID for ISubscriptionService interface\n     * @return Returns interface ID for ISubscriptionService interface\n     */\n    // https://github.com/crytic/slither/wiki/Detector-Documentation#conformance-to-solidity-naming-conventions\n    // slither-disable-next-line naming-convention\n    function INTERFACE_ID() external view returns (bytes4);\n\n    // solhint-enable func-name-mixedcase\n}\n"
      },
      "contracts/interfaces/IVestingCustomFactory.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\n// Copyright 2023 Enjinstarter\npragma solidity 0.8.19;\n\nimport {IAccessControl} from \"@openzeppelin/contracts/access/IAccessControl.sol\";\nimport {IAdminPrivileges} from \"./IAdminPrivileges.sol\";\nimport {IFactoryImplementation} from \"./IFactoryImplementation.sol\";\n\n/**\n * @title IVestingCustomFactory\n * @author Tim Loh\n * @notice Custom vesting factory interface for deploying custom vesting contracts based on implementation\n */\ninterface IVestingCustomFactory is IAccessControl, IAdminPrivileges {\n    /**\n     * @notice Emitted when backoffice admin address has been changed from `oldBackofficeAdminAddress` to\n     *         `newBackofficeAdminAddress`\n     * @param oldBackofficeAdminAddress The backoffice admin address before the change\n     * @param newBackofficeAdminAddress The backoffice admin address after the change\n     * @param sender The address that changes the backoffice admin address\n     */\n    event BackofficeAdminAddressChanged(\n        address indexed oldBackofficeAdminAddress,\n        address indexed newBackofficeAdminAddress,\n        address indexed sender\n    );\n\n    /**\n     * @notice Emitted when contract has been successfully deployed\n     * @param deployedContract The address of the deployed contract\n     * @param deployId The deployment identifier\n     * @param subscriptionId The subscription identifier\n     * @param deployName The deployment name\n     * @param tokenAddress The vesting token address\n     * @param tokenDecimals The number of decimals for vesting token\n     * @param allowAccumulate `true` if multiple grant amounts is allowed to accumulate for the same user,\n     *                        `false` if a user can only have one grant\n     * @param backofficeAddress The backoffice admin address that is set for deploy contract\n     * @param tenantAdminAddress The tenant admin address that is set for deploy contract\n     * @param signer The signer address corresponding to the given signature\n     * @param implementation The reference contract implementation address\n     */\n    event ContractDeployed(\n        address indexed deployedContract,\n        bytes32 indexed deployId,\n        bytes32 indexed subscriptionId,\n        string deployName,\n        address tokenAddress,\n        uint256 tokenDecimals,\n        bool allowAccumulate,\n        address backofficeAddress,\n        address tenantAdminAddress,\n        address signer,\n        address implementation\n    );\n\n    /**\n     * @notice Emitted when implementation address has been changed from `oldImplementation` to `newImplementation`\n     * @param oldImplementation The implementation address before the change\n     * @param newImplementation The implementation address after the change\n     * @param sender The address that changes the implementation address\n     */\n    event ImplementationAddressChanged(\n        address indexed oldImplementation,\n        address indexed newImplementation,\n        address indexed sender\n    );\n\n    /**\n     * @notice Emitted when subscription service contract address has been changed from `oldAddress` to `newAddress`\n     * @param oldAddress The subscription service contract address before the change\n     * @param newAddress The subscription service contract address after the change\n     * @param sender The address that changes the subscription service contract address\n     */\n    event SubscriptionServiceChanged(address indexed oldAddress, address indexed newAddress, address indexed sender);\n\n    /**\n     * @notice Deploy contract based on given typed signature\n     * @param deployId The deploy identifier\n     * @param subscriptionId The subscription identifier\n     * @param name The deployment name\n     * @param tokenAddress The vesting token address\n     * @param tokenDecimals The number of decimals for vesting token\n     * @param allowAccumulate `true` if multiple grant amounts is allowed to accumulate for the same user,\n     *                        `false` if a user can only have one grant\n     * @param signature The typed signature must be from an authorized signer before contract is deployed\n     */\n    function deployWithTypedSignature(\n        bytes32 deployId,\n        bytes32 subscriptionId,\n        string memory name,\n        address tokenAddress,\n        uint256 tokenDecimals,\n        bool allowAccumulate,\n        bytes memory signature\n    ) external;\n\n    /**\n     * @notice Pause user functions (deploy)\n     * @dev Must be called by backoffice contract admin role\n     */\n    function pauseContract() external;\n\n    /**\n     * @notice Change backoffice admin address that will be set for deploy contract to a new address\n     * @dev Must be called by backoffice contract admin role\n     * @param newBackofficeAdminAddress The new backoffice admin address\n     */\n    function setBackofficeAdminAddress(address newBackofficeAdminAddress) external;\n\n    /**\n     * @notice Change implementation to a new address\n     * @dev Must be called by backoffice governance role\n     * @param newImplementation The new implementation address\n     */\n    function setImplementationAddress(address newImplementation) external;\n\n    /**\n     * @notice Change subscription service contract address\n     * @dev Must be called by backoffice governance role\n     * @param newAddress The new contract address\n     */\n    function setSubscriptionService(address newAddress) external;\n\n    /**\n     * @notice Unpause user functions (deploy)\n     * @dev Must be called by backoffice contract admin role\n     */\n    function unpauseContract() external;\n\n    /**\n     * @notice Get backoffice admin address that will be set for deploy contract\n     * @return Returns backoffice admin address\n     */\n    function backofficeAdminAddress() external view returns (address);\n\n    /**\n     * @notice Returns deployment info for given deploy identifier\n     * @param deployId The deploy identifier\n     * @return implementation The reference contract implementation address\n     * @return deployedContract The deployed contract address\n     */\n    function deployInfoFor(bytes32 deployId) external view returns (address implementation, address deployedContract);\n\n    /**\n     * @notice Get factory name\n     * @return Returns factory name\n     */\n    function factoryName() external view returns (string memory);\n\n    /**\n     * @notice Get factory version\n     * @return Returns factory version\n     */\n    function factoryVersion() external view returns (string memory);\n\n    /**\n     * @notice Get reference implementation contract address\n     * @return Returns reference implementation contract address\n     */\n    function implementationAddress() external view returns (address);\n\n    /**\n     * @notice Returns signer of given typed signature\n     * @param implementation The reference contract implementation address\n     * @param deployId The deploy identifier\n     * @param name The deployment name\n     * @param tokenAddress The vesting token address\n     * @param tokenDecimals The number of decimals for vesting token\n     * @param allowAccumulate `true` if multiple grant amounts is allowed to accumulate for the same user,\n     *                        `false` if a user can only have one grant\n     * @param tenantAdminAddress The tenant admin address that will be set for deploy contract\n     * @param signature The typed signature is verified to be from an authorized signer before contract is deployed\n     * @return recovered The signer address\n     */\n    function recoverTypedSignature(\n        address implementation,\n        bytes32 deployId,\n        string memory name,\n        address tokenAddress,\n        uint256 tokenDecimals,\n        bool allowAccumulate,\n        address tenantAdminAddress,\n        bytes memory signature\n    ) external view returns (address recovered);\n\n    /**\n     * @notice Get subscription serbice contract address\n     * @return Returns subscription service contract address\n     */\n    function subscriptionService() external view returns (address);\n}\n"
      },
      "contracts/VestingCustomFactory.sol": {
        "content": "// SPDX-License-Identifier: Apache-2.0\n// Copyright 2023 Enjinstarter\npragma solidity 0.8.19;\n\nimport {Clones} from \"@openzeppelin/contracts/proxy/Clones.sol\";\nimport {Pausable} from \"@openzeppelin/contracts/security/Pausable.sol\";\nimport {ReentrancyGuard} from \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport {Address} from \"@openzeppelin/contracts/utils/Address.sol\";\nimport {ECDSA} from \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport {EIP712} from \"@openzeppelin/contracts/utils/cryptography/EIP712.sol\";\nimport {AdminPrivileges} from \"./AdminPrivileges.sol\";\nimport {ISubscriptionService} from \"./interfaces/ISubscriptionService.sol\";\nimport {IFactoryImplementation, IVestingCustomFactory} from \"./interfaces/IVestingCustomFactory.sol\";\n\n/**\n * @title VestingCustomFactory\n * @author Tim Loh\n * @notice Provides an implementation of custom vesting factory interface for deploying custom vesting contracts based\n *         on reference implementation\n */\ncontract VestingCustomFactory is AdminPrivileges, EIP712, Pausable, ReentrancyGuard, IVestingCustomFactory {\n    using Address for address;\n    using Clones for address;\n    using ECDSA for bytes32;\n\n    struct DeployInfo {\n        address implementation; // address of reference implementation\n        address deployedContract; // address of deployed contract\n        bool isInitialized; // `true` if initialized\n    }\n\n    uint256 public constant SIGNATURE_LENGTH = 65;\n    uint256 public constant TOKEN_DECIMALS_MAX = 18;\n\n    uint256 public immutable factoryImplementationType;\n\n    address public backofficeAdminAddress;\n    // https://github.com/crytic/slither/wiki/Detector-Documentation#state-variables-that-could-be-declared-immutable\n    // slither-disable-next-line immutable-states\n    string public factoryName;\n    // slither-disable-next-line immutable-states\n    string public factoryVersion;\n    address public implementationAddress;\n    address public subscriptionService;\n\n    mapping(bytes32 => DeployInfo) private _deployments;\n\n    /**\n     * @notice The meaning of `name` and `version` is specified in\n     *         https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator\n     */\n    constructor(string memory name, string memory version, uint256 implementationType) EIP712(name, version) {\n        _setRoleAdmin(BACKOFFICE_ROLE_ADMIN_ROLE, BACKOFFICE_ROLE_ADMIN_ROLE);\n        _setRoleAdmin(BACKOFFICE_GOVERNANCE_ROLE, BACKOFFICE_ROLE_ADMIN_ROLE);\n        _setRoleAdmin(BACKOFFICE_CONTRACT_ADMIN_ROLE, BACKOFFICE_ROLE_ADMIN_ROLE);\n\n        _grantRole(BACKOFFICE_ROLE_ADMIN_ROLE, msg.sender);\n        _grantRole(BACKOFFICE_GOVERNANCE_ROLE, msg.sender);\n        _grantRole(BACKOFFICE_CONTRACT_ADMIN_ROLE, msg.sender);\n\n        factoryName = name;\n        factoryVersion = version;\n        factoryImplementationType = implementationType;\n    }\n\n    /**\n     * @inheritdoc IVestingCustomFactory\n     */\n    function deployWithTypedSignature(\n        bytes32 deployId,\n        bytes32 subscriptionId,\n        string memory name,\n        address tokenAddress,\n        uint256 tokenDecimals,\n        bool allowAccumulate,\n        bytes memory signature\n    ) external virtual override whenNotPaused {\n        _deployWithTypedSignature(\n            deployId,\n            subscriptionId,\n            name,\n            tokenAddress,\n            tokenDecimals,\n            allowAccumulate,\n            backofficeAdminAddress,\n            msg.sender,\n            signature\n        );\n    }\n\n    /**\n     * @inheritdoc IVestingCustomFactory\n     */\n    function pauseContract() external virtual override onlyRole(BACKOFFICE_CONTRACT_ADMIN_ROLE) {\n        _pause();\n    }\n\n    /**\n     * @inheritdoc IVestingCustomFactory\n     */\n    function setBackofficeAdminAddress(\n        address newBackofficeAdminAddress\n    ) external virtual override onlyRole(BACKOFFICE_CONTRACT_ADMIN_ROLE) {\n        require(newBackofficeAdminAddress != address(0), \"VCF: backoffice admin\");\n\n        address oldBackofficeAdminAddress = backofficeAdminAddress;\n        backofficeAdminAddress = newBackofficeAdminAddress;\n\n        emit BackofficeAdminAddressChanged(oldBackofficeAdminAddress, newBackofficeAdminAddress, msg.sender);\n    }\n\n    /**\n     * @inheritdoc IVestingCustomFactory\n     */\n    function setImplementationAddress(\n        address newImplementation\n    ) external virtual override onlyRole(BACKOFFICE_GOVERNANCE_ROLE) {\n        require(newImplementation != address(0), \"VCF: new implementation\");\n\n        address oldImplementation = implementationAddress;\n        implementationAddress = newImplementation;\n\n        emit ImplementationAddressChanged(oldImplementation, newImplementation, msg.sender);\n\n        uint256 implementationType = IFactoryImplementation(newImplementation).factoryImplementationType();\n        require(implementationType == factoryImplementationType, \"VCF: implementation type\");\n    }\n\n    /**\n     * @inheritdoc IVestingCustomFactory\n     */\n    function setSubscriptionService(address newAddress) external virtual override onlyRole(BACKOFFICE_GOVERNANCE_ROLE) {\n        require(newAddress != address(0), \"VCF: address\");\n\n        address oldAddress = subscriptionService;\n        subscriptionService = newAddress;\n\n        emit SubscriptionServiceChanged(oldAddress, newAddress, msg.sender);\n\n        bool supportsSubscriptionServiceInterface = ISubscriptionService(newAddress).supportsInterface(\n            type(ISubscriptionService).interfaceId\n        );\n        require(supportsSubscriptionServiceInterface, \"VCF: interface\");\n    }\n\n    /**\n     * @inheritdoc IVestingCustomFactory\n     */\n    function unpauseContract() external virtual override onlyRole(BACKOFFICE_CONTRACT_ADMIN_ROLE) {\n        _unpause();\n    }\n\n    /**\n     * @inheritdoc IVestingCustomFactory\n     */\n    function deployInfoFor(\n        bytes32 deployId\n    ) external view virtual override returns (address implementation, address deployedContract) {\n        require(_deployments[deployId].isInitialized, \"VCF: uninitialized\");\n\n        implementation = _deployments[deployId].implementation;\n        deployedContract = _deployments[deployId].deployedContract;\n    }\n\n    /**\n     * @inheritdoc IVestingCustomFactory\n     */\n    function recoverTypedSignature(\n        address implementation,\n        bytes32 deployId,\n        string memory name,\n        address tokenAddress,\n        uint256 tokenDecimals,\n        bool allowAccumulate,\n        address tenantAdminAddress,\n        bytes memory signature\n    ) external view virtual override returns (address recovered) {\n        recovered = _recoverTypedSignature(\n            implementation,\n            deployId,\n            name,\n            tokenAddress,\n            tokenDecimals,\n            allowAccumulate,\n            tenantAdminAddress,\n            signature\n        );\n    }\n\n    /**\n     * @dev Consume purchased subscription package by `account` to deploy a contract\n     * @param subscriptionId The subscription identifier\n     * @param account The account consuming the subscription package to deploy a contract\n     * @return isConsumed Returns whether subscription package has been successfully consumed\n     */\n    function _consumeSubscriptionPackage(\n        bytes32 subscriptionId,\n        address account\n    ) internal virtual returns (bool isConsumed) {\n        require(subscriptionService != address(0), \"VCF: subscription\");\n\n        isConsumed = ISubscriptionService(subscriptionService).consumeSubscriptionPackage(subscriptionId, account);\n    }\n\n    /**\n     * @dev Deploy contract based on given typed signature\n     * @param deployId The deploy identifier\n     * @param subscriptionId The subscription identifier\n     * @param name The deployment name\n     * @param tokenAddress The vesting token address\n     * @param tokenDecimals The number of decimals for vesting token\n     * @param allowAccumulate `true` if multiple grant amounts is allowed to accumulate for the same user,\n     *                        `false` if a user can only have one grant\n     * @param backofficeAddress The backoffice admin address that will be set for deploy contract\n     * @param tenantAdminAddress The tenant admin address that will be set for deploy contract\n     * @param signature The typed signature must be from an authorized signer before contract is deployed\n     */\n    function _deployWithTypedSignature(\n        bytes32 deployId,\n        bytes32 subscriptionId,\n        string memory name,\n        address tokenAddress,\n        uint256 tokenDecimals,\n        bool allowAccumulate,\n        address backofficeAddress,\n        address tenantAdminAddress,\n        bytes memory signature\n    ) internal virtual nonReentrant {\n        require(!_deployments[deployId].isInitialized, \"VCF: exists\");\n        require(backofficeAddress != address(0), \"VCF: backoffice address\");\n\n        address recovered = _recoverTypedSignature(\n            implementationAddress,\n            deployId,\n            name,\n            tokenAddress,\n            tokenDecimals,\n            allowAccumulate,\n            tenantAdminAddress,\n            signature\n        );\n        require(msg.sender == recovered, \"VCF: sender\");\n\n        bytes memory saltdata = _encodeSaltData(deployId);\n        bytes32 salt = keccak256(saltdata);\n        address deployedAddress = implementationAddress.cloneDeterministic(salt);\n        require(deployedAddress != address(0), \"VCF: deployed address\");\n\n        _deployments[deployId] = DeployInfo({\n            implementation: implementationAddress,\n            deployedContract: deployedAddress,\n            isInitialized: true\n        });\n\n        bytes memory initializeData = _encodeInitializeData(\n            tokenAddress,\n            tokenDecimals,\n            allowAccumulate,\n            backofficeAddress,\n            tenantAdminAddress\n        );\n\n        emit ContractDeployed(\n            deployedAddress,\n            deployId,\n            subscriptionId,\n            name,\n            tokenAddress,\n            tokenDecimals,\n            allowAccumulate,\n            backofficeAddress,\n            tenantAdminAddress,\n            recovered,\n            implementationAddress\n        );\n\n        require(_consumeSubscriptionPackage(subscriptionId, recovered), \"VCF: consume\");\n\n        // https://github.com/crytic/slither/wiki/Detector-Documentation#unused-return\n        // slither-disable-next-line unused-return\n        deployedAddress.functionCall(initializeData);\n    }\n\n    /**\n     * @dev Returns signer of given typed signature\n     * @param implementation The reference contract implementation address\n     * @param deployId The deploy identifier\n     * @param name The deployment name\n     * @param tokenAddress The vesting token address\n     * @param tokenDecimals The number of decimals for vesting token\n     * @param allowAccumulate `true` if multiple grant amounts is allowed to accumulate for the same user,\n     *                        `false` if a user can only have one grant\n     * @param tenantAdminAddress The tenant admin address that will be set for deploy contract\n     * @param signature The typed signature is verified to be from an authorized signer before contract is deployed\n     * @return recovered The signer address\n     */\n    function _recoverTypedSignature(\n        address implementation,\n        bytes32 deployId,\n        string memory name,\n        address tokenAddress,\n        uint256 tokenDecimals,\n        bool allowAccumulate,\n        address tenantAdminAddress,\n        bytes memory signature\n    ) internal view virtual returns (address recovered) {\n        require(implementation != address(0), \"VCF: implementation\");\n        require(bytes(name).length > 0, \"VCF: name\");\n        require(tokenAddress != address(0), \"VCF: token address\");\n        require(tokenDecimals <= TOKEN_DECIMALS_MAX, \"VCF: token decimals\");\n        require(tenantAdminAddress != address(0), \"VCF: tenant address\");\n        require(signature.length == SIGNATURE_LENGTH, \"VCF: signature\");\n\n        bytes32 digest = _hashTypedDataV4(\n            keccak256(\n                abi.encode(\n                    keccak256(\n                        \"VestingCustom(\"\n                        \"address implementation,\"\n                        \"bytes32 deployId,\"\n                        \"string name,\"\n                        \"address tokenAddress,\"\n                        \"uint256 tokenDecimals,\"\n                        \"bool allowAccumulate,\"\n                        \"address tenantAdminAddress\"\n                        \")\"\n                    ),\n                    implementation,\n                    deployId,\n                    keccak256(bytes(name)),\n                    tokenAddress,\n                    tokenDecimals,\n                    allowAccumulate,\n                    tenantAdminAddress\n                )\n            )\n        );\n        recovered = digest.recover(signature);\n        require(recovered != address(0), \"VCF: recovered\");\n    }\n\n    /**\n     * @dev Returns encoded initialization data for deploy contract\n     * @param tokenAddress The vesting token address\n     * @param tokenDecimals The number of decimals for vesting token\n     * @param allowAccumulate `true` if multiple grant amounts is allowed to accumulate for the same user,\n     *                        `false` if a user can only have one grant\n     * @param backofficeAddress The backoffice admin address that will be set for deploy contract\n     * @param tenantAdminAddress The tenant admin address that will be set for deploy contract\n     * @return encodedData The encoded initialization data for deploy contract\n     */\n    function _encodeInitializeData(\n        address tokenAddress,\n        uint256 tokenDecimals,\n        bool allowAccumulate,\n        address backofficeAddress,\n        address tenantAdminAddress\n    ) internal pure virtual returns (bytes memory encodedData) {\n        encodedData = abi.encodeWithSignature(\n            \"initialize(address,uint256,bool,address,address)\",\n            tokenAddress,\n            tokenDecimals,\n            allowAccumulate,\n            backofficeAddress,\n            tenantAdminAddress\n        );\n    }\n\n    /**\n     * @dev Returns encoded salt data for deploy contract\n     * @param deployId The deploy identifier\n     * @return encodedData The encoded salt data for deploy contract\n     */\n    function _encodeSaltData(bytes32 deployId) internal pure virtual returns (bytes memory encodedData) {\n        encodedData = abi.encodeWithSignature(\"salt(bytes32)\", deployId);\n    }\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "libraries": {}
    }
  }}