creation_sourcecode: {{
    "language": "Solidity",
    "settings": {
      "evmVersion": "london",
      "libraries": {},
      "metadata": {
        "bytecodeHash": "ipfs",
        "useLiteralContent": true
      },
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "remappings": [],
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    },
    "sources": {
      "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerableUpgradeable.sol\";\nimport \"./AccessControlUpgradeable.sol\";\nimport \"../utils/structs/EnumerableSetUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable {\n    function __AccessControlEnumerable_init() internal onlyInitializing {\n    }\n\n    function __AccessControlEnumerable_init_unchained() internal onlyInitializing {\n    }\n    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;\n\n    mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers;\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IAccessControlEnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns one of the accounts that have `role`. `index` must be a\n     * value between 0 and {getRoleMemberCount}, non-inclusive.\n     *\n     * Role bearers are not sorted in any particular way, and their ordering may\n     * change at any point.\n     *\n     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n     * you perform all queries on the same block. See the following\n     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n     * for more information.\n     */\n    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\n        return _roleMembers[role].at(index);\n    }\n\n    /**\n     * @dev Returns the number of accounts that have `role`. Can be used\n     * together with {getRoleMember} to enumerate all bearers of a role.\n     */\n    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\n        return _roleMembers[role].length();\n    }\n\n    /**\n     * @dev Overload {_grantRole} to track enumerable memberships\n     */\n    function _grantRole(bytes32 role, address account) internal virtual override {\n        super._grantRole(role, account);\n        _roleMembers[role].add(account);\n    }\n\n    /**\n     * @dev Overload {_revokeRole} to track enumerable memberships\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual override {\n        super._revokeRole(role, account);\n        _roleMembers[role].remove(account);\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.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 * ```\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 * ```\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.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n    function __AccessControl_init() internal onlyInitializing {\n    }\n\n    function __AccessControl_init_unchained() internal onlyInitializing {\n    }\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(IAccessControlUpgradeable).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                        StringsUpgradeable.toHexString(account),\n                        \" is missing role \",\n                        StringsUpgradeable.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    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/access/IAccessControlEnumerableUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable {\n    /**\n     * @dev Returns one of the accounts that have `role`. `index` must be a\n     * value between 0 and {getRoleMemberCount}, non-inclusive.\n     *\n     * Role bearers are not sorted in any particular way, and their ordering may\n     * change at any point.\n     *\n     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n     * you perform all queries on the same block. See the following\n     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n     * for more information.\n     */\n    function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n    /**\n     * @dev Returns the number of accounts that have `role`. Can be used\n     * together with {getRoleMember} to enumerate all bearers of a role.\n     */\n    function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.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 IAccessControlUpgradeable {\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-upgradeable/governance/utils/IVotesUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (governance/utils/IVotes.sol)\npragma solidity ^0.8.0;\n\n/**\n * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts.\n *\n * _Available since v4.5._\n */\ninterface IVotesUpgradeable {\n    /**\n     * @dev Emitted when an account changes their delegate.\n     */\n    event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);\n\n    /**\n     * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes.\n     */\n    event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);\n\n    /**\n     * @dev Returns the current amount of votes that `account` has.\n     */\n    function getVotes(address account) external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`).\n     */\n    function getPastVotes(address account, uint256 blockNumber) external view returns (uint256);\n\n    /**\n     * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`).\n     *\n     * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes.\n     * Votes that have not been delegated are still part of total supply, even though they would not participate in a\n     * vote.\n     */\n    function getPastTotalSupply(uint256 blockNumber) external view returns (uint256);\n\n    /**\n     * @dev Returns the delegate that `account` has chosen.\n     */\n    function delegates(address account) external view returns (address);\n\n    /**\n     * @dev Delegates votes from the sender to `delegatee`.\n     */\n    function delegate(address delegatee) external;\n\n    /**\n     * @dev Delegates votes from signer to `delegatee`.\n     */\n    function delegateBySig(\n        address delegatee,\n        uint256 nonce,\n        uint256 expiry,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\n *     }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n *     function initializeV2() reinitializer(2) public {\n *         __ERC20Permit_init(\"MyToken\");\n *     }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n *     _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Indicates that the contract has been initialized.\n     * @custom:oz-retyped-from bool\n     */\n    uint8 private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint8 version);\n\n    /**\n     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n     * `onlyInitializing` functions can be used to initialize parent contracts.\n     *\n     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n     * constructor.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier initializer() {\n        bool isTopLevelCall = !_initializing;\n        require(\n            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n            \"Initializable: contract is already initialized\"\n        );\n        _initialized = 1;\n        if (isTopLevelCall) {\n            _initializing = true;\n        }\n        _;\n        if (isTopLevelCall) {\n            _initializing = false;\n            emit Initialized(1);\n        }\n    }\n\n    /**\n     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n     * used to initialize parent contracts.\n     *\n     * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n     * are added through upgrades and that require initialization.\n     *\n     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n     * cannot be nested. If one is invoked in the context of another, execution will revert.\n     *\n     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n     * a contract, executing them in the right order is up to the developer or operator.\n     *\n     * WARNING: setting the version to 255 will prevent any future reinitialization.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier reinitializer(uint8 version) {\n        require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n        _initialized = version;\n        _initializing = true;\n        _;\n        _initializing = false;\n        emit Initialized(version);\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} and {reinitializer} modifiers, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        require(_initializing, \"Initializable: contract is not initializing\");\n        _;\n    }\n\n    /**\n     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n     * through proxies.\n     *\n     * Emits an {Initialized} event the first time it is successfully executed.\n     */\n    function _disableInitializers() internal virtual {\n        require(!_initializing, \"Initializable: contract is initializing\");\n        if (_initialized < type(uint8).max) {\n            _initialized = type(uint8).max;\n            emit Initialized(type(uint8).max);\n        }\n    }\n\n    /**\n     * @dev Internal function that returns the initialized version. Returns `_initialized`\n     */\n    function _getInitializedVersion() internal view returns (uint8) {\n        return _initialized;\n    }\n\n    /**\n     * @dev Internal function that returns the initialized version. Returns `_initializing`\n     */\n    function _isInitializing() internal view returns (bool) {\n        return _initializing;\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC1155 compliant contract, as defined in the\n * https://eips.ethereum.org/EIPS/eip-1155[EIP].\n *\n * _Available since v3.1._\n */\ninterface IERC1155Upgradeable is IERC165Upgradeable {\n    /**\n     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.\n     */\n    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);\n\n    /**\n     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all\n     * transfers.\n     */\n    event TransferBatch(\n        address indexed operator,\n        address indexed from,\n        address indexed to,\n        uint256[] ids,\n        uint256[] values\n    );\n\n    /**\n     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to\n     * `approved`.\n     */\n    event ApprovalForAll(address indexed account, address indexed operator, bool approved);\n\n    /**\n     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.\n     *\n     * If an {URI} event was emitted for `id`, the standard\n     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value\n     * returned by {IERC1155MetadataURI-uri}.\n     */\n    event URI(string value, uint256 indexed id);\n\n    /**\n     * @dev Returns the amount of tokens of token type `id` owned by `account`.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function balanceOf(address account, uint256 id) external view returns (uint256);\n\n    /**\n     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.\n     *\n     * Requirements:\n     *\n     * - `accounts` and `ids` must have the same length.\n     */\n    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)\n        external\n        view\n        returns (uint256[] memory);\n\n    /**\n     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,\n     *\n     * Emits an {ApprovalForAll} event.\n     *\n     * Requirements:\n     *\n     * - `operator` cannot be the caller.\n     */\n    function setApprovalForAll(address operator, bool approved) external;\n\n    /**\n     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.\n     *\n     * See {setApprovalForAll}.\n     */\n    function isApprovedForAll(address account, address operator) external view returns (bool);\n\n    /**\n     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.\n     *\n     * Emits a {TransferSingle} event.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.\n     * - `from` must have a balance of tokens of type `id` of at least `amount`.\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the\n     * acceptance magic value.\n     */\n    function safeTransferFrom(\n        address from,\n        address to,\n        uint256 id,\n        uint256 amount,\n        bytes calldata data\n    ) external;\n\n    /**\n     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.\n     *\n     * Emits a {TransferBatch} event.\n     *\n     * Requirements:\n     *\n     * - `ids` and `amounts` must have the same length.\n     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the\n     * acceptance magic value.\n     */\n    function safeBatchTransferFrom(\n        address from,\n        address to,\n        uint256[] calldata ids,\n        uint256[] calldata amounts,\n        bytes calldata data\n    ) external;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\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     *\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://diligence.consensys.net/posts/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.5.11/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(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) 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 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-upgradeable/utils/ContextUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\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 ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\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    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\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 = MathUpgradeable.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 `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        unchecked {\n            return toHexString(value, MathUpgradeable.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"
      },
      "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {\n    function __ERC165_init() internal onlyInitializing {\n    }\n\n    function __ERC165_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165Upgradeable).interfaceId;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {\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-upgradeable/utils/math/MathUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.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 MathUpgradeable {\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(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) 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                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1);\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(\n        uint256 x,\n        uint256 y,\n        uint256 denominator,\n        Rounding rounding\n    ) 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 10, 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 * 8) < value ? 1 : 0);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)\n// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n *     // Add the library methods\n *     using EnumerableSet for EnumerableSet.AddressSet;\n *\n *     // Declare a set state variable\n *     EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure\n * unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an\n * array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSetUpgradeable {\n    // To implement this library for multiple types with as little code\n    // repetition as possible, we write it in terms of a generic Set type with\n    // bytes32 values.\n    // The Set implementation uses private functions, and user-facing\n    // implementations (such as AddressSet) are just wrappers around the\n    // underlying Set.\n    // This means that we can only create new EnumerableSets for types that fit\n    // in bytes32.\n\n    struct Set {\n        // Storage of set values\n        bytes32[] _values;\n        // Position of the value in the `values` array, plus 1 because index 0\n        // means a value is not in the set.\n        mapping(bytes32 => uint256) _indexes;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function _add(Set storage set, bytes32 value) private returns (bool) {\n        if (!_contains(set, value)) {\n            set._values.push(value);\n            // The value is stored at length-1, but we add 1 to all indexes\n            // and use 0 as a sentinel value\n            set._indexes[value] = set._values.length;\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function _remove(Set storage set, bytes32 value) private returns (bool) {\n        // We read and store the value's index to prevent multiple reads from the same storage slot\n        uint256 valueIndex = set._indexes[value];\n\n        if (valueIndex != 0) {\n            // Equivalent to contains(set, value)\n            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n            // the array, and then remove the last element (sometimes called as 'swap and pop').\n            // This modifies the order of the array, as noted in {at}.\n\n            uint256 toDeleteIndex = valueIndex - 1;\n            uint256 lastIndex = set._values.length - 1;\n\n            if (lastIndex != toDeleteIndex) {\n                bytes32 lastValue = set._values[lastIndex];\n\n                // Move the last value to the index where the value to delete is\n                set._values[toDeleteIndex] = lastValue;\n                // Update the index for the moved value\n                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n            }\n\n            // Delete the slot where the moved value was stored\n            set._values.pop();\n\n            // Delete the index for the deleted slot\n            delete set._indexes[value];\n\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function _contains(Set storage set, bytes32 value) private view returns (bool) {\n        return set._indexes[value] != 0;\n    }\n\n    /**\n     * @dev Returns the number of values on the set. O(1).\n     */\n    function _length(Set storage set) private view returns (uint256) {\n        return set._values.length;\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function _at(Set storage set, uint256 index) private view returns (bytes32) {\n        return set._values[index];\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function _values(Set storage set) private view returns (bytes32[] memory) {\n        return set._values;\n    }\n\n    // Bytes32Set\n\n    struct Bytes32Set {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _add(set._inner, value);\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n        return _remove(set._inner, value);\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n        return _contains(set._inner, value);\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(Bytes32Set storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n        return _at(set._inner, index);\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        bytes32[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // AddressSet\n\n    struct AddressSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(AddressSet storage set, address value) internal returns (bool) {\n        return _add(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(AddressSet storage set, address value) internal returns (bool) {\n        return _remove(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(AddressSet storage set, address value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(uint256(uint160(value))));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(AddressSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(AddressSet storage set, uint256 index) internal view returns (address) {\n        return address(uint160(uint256(_at(set._inner, index))));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(AddressSet storage set) internal view returns (address[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        address[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n\n    // UintSet\n\n    struct UintSet {\n        Set _inner;\n    }\n\n    /**\n     * @dev Add a value to a set. O(1).\n     *\n     * Returns true if the value was added to the set, that is if it was not\n     * already present.\n     */\n    function add(UintSet storage set, uint256 value) internal returns (bool) {\n        return _add(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Removes a value from a set. O(1).\n     *\n     * Returns true if the value was removed from the set, that is if it was\n     * present.\n     */\n    function remove(UintSet storage set, uint256 value) internal returns (bool) {\n        return _remove(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns true if the value is in the set. O(1).\n     */\n    function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n        return _contains(set._inner, bytes32(value));\n    }\n\n    /**\n     * @dev Returns the number of values in the set. O(1).\n     */\n    function length(UintSet storage set) internal view returns (uint256) {\n        return _length(set._inner);\n    }\n\n    /**\n     * @dev Returns the value stored at position `index` in the set. O(1).\n     *\n     * Note that there are no guarantees on the ordering of values inside the\n     * array, and it may change when more values are added or removed.\n     *\n     * Requirements:\n     *\n     * - `index` must be strictly less than {length}.\n     */\n    function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n        return uint256(_at(set._inner, index));\n    }\n\n    /**\n     * @dev Return the entire set in an array\n     *\n     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n     * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n     */\n    function values(UintSet storage set) internal view returns (uint256[] memory) {\n        bytes32[] memory store = _values(set._inner);\n        uint256[] memory result;\n\n        /// @solidity memory-safe-assembly\n        assembly {\n            result := store\n        }\n\n        return result;\n    }\n}\n"
      },
      "contracts/Registry.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"./registry/CompaniesRegistry.sol\";\r\nimport \"./registry/RecordsRegistry.sol\";\r\nimport \"./registry/TokensRegistry.sol\";\r\n\r\n/**\r\n * @title Registry Contract\r\n * @notice This contract serves as a registry to store all events, contracts, and proposals of all pools using global sequential numbering.\r\n * @dev The repository of all user and business entities created by the protocol: companies to be implemented, contracts to be deployed, proposals created by shareholders. The main logic of the registry is implemented in contracts that inherit from Registry.\r\n */\r\ncontract Registry is CompaniesRegistry, RecordsRegistry, TokensRegistry {\r\n    /// @dev This mapping stores the correspondence between the pool address, the local proposal number, and its global number registered in the registry.\r\n    mapping(address => mapping(uint256 => uint256)) public globalProposalIds;\r\n    event Log(address sender, address receiver, uint256 value, bytes data);\r\n\r\n    mapping(uint256 => address) public companyAddress;\r\n\r\n    /**\r\n     * @notice Contract constructor.\r\n     * @dev This contract uses OpenZeppelin upgrades and has no need for a constructor function.\r\n     * The constructor is replaced with an initializer function.\r\n     * This method disables the initializer feature of the OpenZeppelin upgrades plugin, preventing the initializer methods from being misused.\r\n     * @custom:oz-upgrades-unsafe-allow constructor\r\n     */\r\n    constructor() {\r\n        _disableInitializers();\r\n    }\r\n\r\n    /**\r\n     * @notice Contract initializer\r\n     * @dev This method replaces the constructor for upgradeable contracts.\r\n     */\r\n    function initialize() public initializer {\r\n        __RegistryBase_init();\r\n    }\r\n\r\n    // INTERNAL FUNCTIONS\r\n\r\n    /**\r\n     * @dev Update global proposal ID\r\n     * @param pool Pool address\r\n     * @param proposalId Local Proposal ID\r\n     * @param globalProposalId Global Proposal ID\r\n     */\r\n    function setGlobalProposalId(\r\n        address pool,\r\n        uint256 proposalId,\r\n        uint256 globalProposalId\r\n    ) internal override {\r\n        globalProposalIds[pool][proposalId] = globalProposalId;\r\n    }\r\n\r\n    function _setIndexAddress(\r\n        uint256 index,\r\n        address poolAddress\r\n    ) internal override {\r\n        companyAddress[index] = poolAddress;\r\n    }\r\n\r\n    // VIEW FUNCTIONS\r\n\r\n    function getPoolAddressByIndex(\r\n        uint256 index\r\n    ) public view returns (address) {\r\n        return companyAddress[index];\r\n    }\r\n\r\n    /**\r\n     * @dev Return global proposal ID\r\n     * @param pool Pool address\r\n     * @param proposalId Proposal ID\r\n     * @return Global proposal ID\r\n     */\r\n    function getGlobalProposalId(\r\n        address pool,\r\n        uint256 proposalId\r\n    ) public view returns (uint256) {\r\n        return globalProposalIds[pool][proposalId];\r\n    }\r\n\r\n    function log(\r\n        address sender,\r\n        address receiver,\r\n        uint256 value,\r\n        bytes memory data\r\n    ) external {\r\n        require(\r\n            msg.sender == address(this) ||\r\n                msg.sender == service ||\r\n                msg.sender == address(IService(service).tgeFactory()) ||\r\n                msg.sender == address(IService(service).invoice()) ||\r\n                msg.sender == address(IService(service).vesting()) ||\r\n                msg.sender == address(IService(service).idRegistry()) ||\r\n                typeOf(msg.sender) == IRecordsRegistry.ContractType.Pool ||\r\n                typeOf(msg.sender) == IRecordsRegistry.ContractType.TGE ||\r\n                typeOf(msg.sender) ==\r\n                IRecordsRegistry.ContractType.GovernanceToken ||\r\n                typeOf(msg.sender) ==\r\n                IRecordsRegistry.ContractType.PreferenceToken,\r\n            ExceptionsLibrary.INVALID_USER\r\n        );\r\n        // Emit event\r\n        emit CompanyDAOLog(sender, receiver, value, data, address(service));\r\n    }\r\n}\r\n"
      },
      "contracts/interfaces/ICustomProposal.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"./ITGE.sol\";\r\n\r\nimport \"./governor/IGovernanceSettings.sol\";\r\n\r\ninterface ICustomProposal {}\r\n"
      },
      "contracts/interfaces/IInvoice.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n/**\r\n * @title Invoice Interface\r\n * @notice These structures are used to describe an instance of an invoice.\r\n * @dev The storage of invoices is managed in Invoice.sol in the `invoices` variable.\r\n*/\r\ninterface IInvoice {\r\n    /** \r\n    * @notice This interface contains a data structure that describes the payment rules for an invoice. \r\n    * @dev This data is used to validate the payment transaction, determine the state of the invoice, and so on. This data is formed from the input of the invoice creator.\r\n    * @param amount Amount to be paid\r\n    * @param unitOfAccount The address of the token contract that can be used to make the payment (a zero address assumes payment in native ETH)\r\n    * @param expirationBlock The block at which the invoice expires\r\n    * @param description Description of the invoice\r\n    * @param whitelist A whitelist of payers. An empty array denotes a public invoice.\r\n    */\r\n    struct InvoiceCore {\r\n        uint256 amount;\r\n        address unitOfAccount;\r\n        uint256 expirationBlock;\r\n        string description;\r\n        address[] whitelist;\r\n    }\r\n    /**\r\n    * @notice This interface is used to store complete records of invoices, including their current state, metadata, and payment rules.\r\n    * @dev This data is automatically formed when the invoice is created and changes when state-changing transactions are executed.\r\n    * @param core Payment rules (user input)\r\n    * @param invoiceId Invoice identifier\r\n    * @param createdBy The creator of the invoice\r\n    * @param isPaid Flag indicating whether the invoice has been successfully paid\r\n    * @param isCanceled Flag indicating whether the invoice has been canceled\r\n    */\r\n    struct InvoiceInfo {\r\n        InvoiceCore core;\r\n        uint256 invoiceId;\r\n        address createdBy;\r\n        bool isPaid;\r\n        bool isCanceled;\r\n    }\r\n    /**\r\n    * @notice Encoding the states of an individual invoice\r\n    * @dev None - for a non-existent invoice, Paid, Expired, Canceled - are completed invoice states where payment is not possible.\r\n    */\r\n    enum InvoiceState {\r\n        None,\r\n        Active,\r\n        Paid,\r\n        Expired,\r\n        Canceled\r\n    }\r\n\r\n    function createInvoice(address pool, InvoiceCore memory core) external;\r\n\r\n    function payInvoice(address pool, uint256 invoiceId) external payable;\r\n\r\n    function cancelInvoice(address pool, uint256 invoiceId) external;\r\n\r\n    function setInvoiceCanceled(address pool, uint256 invoiceId) external;\r\n}\r\n"
      },
      "contracts/interfaces/IPool.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"./IToken.sol\";\r\nimport \"./registry/IRegistry.sol\";\r\nimport \"./registry/ICompaniesRegistry.sol\";\r\n\r\nimport \"./governor/IGovernor.sol\";\r\nimport \"./governor/IGovernanceSettings.sol\";\r\nimport \"./governor/IGovernorProposals.sol\";\r\nimport \"./ITGEFactory.sol\";\r\n\r\ninterface IPool is IGovernorProposals {\r\n    function initialize(\r\n        ICompaniesRegistry.CompanyInfo memory companyInfo_\r\n    ) external;\r\n\r\n    function setNewOwnerWithSettings(\r\n        address owner_,\r\n        string memory trademark_,\r\n        IGovernanceSettings.NewGovernanceSettings memory governanceSettings_,\r\n        bool forceTransfer\r\n    ) external;\r\n\r\n    function propose(\r\n        address proposer,\r\n        uint256 proposalType,\r\n        IGovernor.ProposalCoreData memory core,\r\n        IGovernor.ProposalMetaData memory meta\r\n    ) external returns (uint256 proposalId);\r\n\r\n    function setToken(address token_, IToken.TokenType tokenType_) external;\r\n\r\n    function setProposalIdToTGE(address tge) external;\r\n\r\n    //function cancelProposal(uint256 proposalId) external;\r\n\r\n    function setSettings(\r\n        IGovernanceSettings.NewGovernanceSettings memory governanceSettings_,\r\n        ITGEFactory.Roles memory roles\r\n    ) external;\r\n\r\n    function owner() external view returns (address);\r\n\r\n    function isDAO() external view returns (bool);\r\n\r\n    function trademark() external view returns (string memory);\r\n\r\n    function getGovernanceToken() external view returns (IToken);\r\n\r\n    function tokenExists(address token) external view returns (bool);\r\n\r\n    function tokenTypeByAddress(\r\n        address token_\r\n    ) external view returns (IToken.TokenType);\r\n\r\n    function isValidProposer(address account) external view returns (bool);\r\n\r\n    function isPoolSecretary(address account) external view returns (bool);\r\n\r\n    // function isValidDividendManager(\r\n    //     address account\r\n    // ) external view returns (bool);\r\n\r\n    function isLastProposalIdByTypeActive(\r\n        uint256 type_\r\n    ) external view returns (bool);\r\n\r\n    function validateGovernanceSettings(\r\n        IGovernanceSettings.NewGovernanceSettings memory settings\r\n    ) external pure;\r\n\r\n    // function getPoolSecretary() external view returns (address[] memory);\r\n\r\n    // function getPoolExecutor() external view returns (address[] memory);\r\n\r\n    function setCompanyInfo(\r\n        uint256 _fee,\r\n        uint256 _jurisdiction,\r\n        uint256 _entityType,\r\n        string memory _ein\r\n    ) external;\r\n\r\n    function castVote(uint256 proposalId, bool support) external;\r\n\r\n    function externalCastVote(\r\n        address account,\r\n        uint256 proposalId,\r\n        bool support\r\n    ) external;\r\n\r\n    // function externalTransferByOwner(\r\n    //     address to,\r\n    //     uint256 amount,\r\n    //     address unitOfAccount\r\n    // ) external;\r\n\r\n    function executeProposal(uint256 proposalId) external;\r\n\r\n    function getCompanyFee() external returns (uint256);\r\n\r\n    function setDAOmetadataURI(string memory _OAuri) external;\r\n}\r\n"
      },
      "contracts/interfaces/IService.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/access/IAccessControlEnumerableUpgradeable.sol\";\r\nimport \"./ITGE.sol\";\r\nimport \"./ICustomProposal.sol\";\r\nimport \"./registry/IRecordsRegistry.sol\";\r\nimport \"./registry/ICompaniesRegistry.sol\";\r\nimport \"./registry/IRegistry.sol\";\r\nimport \"./IToken.sol\";\r\nimport \"./IInvoice.sol\";\r\nimport \"./IVesting.sol\";\r\nimport \"./ITokenFactory.sol\";\r\nimport \"./ITGEFactory.sol\";\r\nimport \"./IPool.sol\";\r\nimport \"./governor/IGovernanceSettings.sol\";\r\n\r\ninterface IService is IAccessControlEnumerableUpgradeable {\r\n    function ADMIN_ROLE() external view returns (bytes32);\r\n\r\n    function WHITELISTED_USER_ROLE() external view returns (bytes32);\r\n\r\n    function SERVICE_MANAGER_ROLE() external view returns (bytes32);\r\n\r\n    function EXECUTOR_ROLE() external view returns (bytes32);\r\n\r\n    function createPool(\r\n        ICompaniesRegistry.CompanyInfo memory companyInfo\r\n    ) external returns (address);\r\n\r\n    function addProposal(uint256 proposalId) external;\r\n\r\n    function addEvent(\r\n        IRecordsRegistry.EventType eventType,\r\n        uint256 proposalId,\r\n        string calldata metaHash\r\n    ) external;\r\n\r\n    function setProtocolCollectedFee(\r\n        address _token,\r\n        uint256 _protocolTokenFee\r\n    ) external;\r\n\r\n    function registry() external view returns (IRegistry);\r\n\r\n    function vesting() external view returns (IVesting);\r\n\r\n    function tokenFactory() external view returns (ITokenFactory);\r\n\r\n    function tgeFactory() external view returns (ITGEFactory);\r\n\r\n    function invoice() external view returns (IInvoice);\r\n\r\n    function protocolTreasury() external view returns (address);\r\n\r\n    function protocolTokenFee() external view returns (uint256);\r\n\r\n    function serviceFee() external view returns (uint256);\r\n\r\n    function getMinSoftCap() external view returns (uint256);\r\n\r\n    function getProtocolTokenFee(\r\n        uint256 amount\r\n    ) external view returns (uint256);\r\n\r\n    function getProtocolCollectedFee(\r\n        address token_\r\n    ) external view returns (uint256);\r\n\r\n    function poolBeacon() external view returns (address);\r\n\r\n    function tgeBeacon() external view returns (address);\r\n\r\n    function tseBeacon() external view returns (address);\r\n\r\n    function idRegistry() external view returns (address);\r\n\r\n    function tokenBeacon() external view returns (address);\r\n\r\n    function tokenERC1155Beacon() external view returns (address);\r\n\r\n    function customProposal() external view returns (ICustomProposal);\r\n\r\n    function validateTGEInfo(\r\n        ITGE.TGEInfo calldata info,\r\n        uint256 cap,\r\n        uint256 totalSupply,\r\n        IToken.TokenType tokenType\r\n    ) external view;\r\n\r\n    function paused() external view returns (bool);\r\n\r\n    function addInvoiceEvent(\r\n        address pool,\r\n        uint256 invoiceId\r\n    ) external returns (uint256);\r\n\r\n    function purchasePool(\r\n        uint256 jurisdiction,\r\n        uint256 entityType,\r\n        string memory trademark,\r\n        IGovernanceSettings.NewGovernanceSettings memory governanceSettings\r\n    ) external payable;\r\n\r\n    function transferPurchasedPoolByService(\r\n        address newowner,\r\n        uint256 jurisdiction,\r\n        uint256 entityType,\r\n        string memory trademark,\r\n        IGovernanceSettings.NewGovernanceSettings memory governanceSettings\r\n    ) external;\r\n\r\n    function getTrustedForwarder() external view returns (address);\r\n\r\n    function setDAOmetadataURI(\r\n        address _pool,\r\n        string memory _DAOmetadataURI\r\n    ) external;\r\n}\r\n"
      },
      "contracts/interfaces/ITGE.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"./IToken.sol\";\r\nimport \"./ITokenERC1155.sol\";\r\nimport \"./IVesting.sol\";\r\n\r\ninterface ITGE {\r\n    /**\r\n     * @notice This structure defines comprehensive TGE settings, including Vesting, Lockup, and distribution rules for these tokens.\r\n     * @dev Initially, such a structure appears as a parameter when creating a proposal in CustomProposal, after which the data from the structure is placed in the storage of the deployed TGE contract.\r\n     * @dev In addition, these data are used as an argument in its original form in the TGEFactory contract, including when creating the initial TGE by the pool owner without a proposal.\r\n     * @param price The price of one token in the smallest unitOfAccount (1 wei when defining the price in ETH, 0.000001 USDT when defining the price in USDT, etc.)\r\n     * @param hardcap The maximum number of tokens that can be sold (note the ProtocolTokenFee for Governance Tokens)\r\n     * @param softcap The minimum number of tokens that buyers must acquire for the TGE to be considered successful\r\n     * @param minPurchase The minimum number of tokens that can be purchased by a single account (minimum one-time purchase)\r\n     * @param maxPurchase The maximum number of tokens that can be purchased by a single account in total during the launched TGE\r\n     * @param duration The duration of the event in blocks, after which the TGE status will be forcibly changed from Active to another\r\n     * @param vestingParams Vesting settings for tokens acquired during this TGE\r\n     * @param userWhiteList A list of addresses allowed to participate in this TGE. Leave the list empty to make the TGE public.\r\n     * @param unitOfAccount The address of the ERC20 or compatible token contract, in the smallest units of which the price of one token is determined\r\n     * @param lockupDuration The duration of token lockup (in blocks), one of two independent lockup conditions.\r\n     * @param lockupTVL The minimum total pool balance in USD, one of two independent lockup conditions.\r\n     */\r\n\r\n    struct TGEInfo {\r\n        uint256 price;\r\n        uint256 hardcap;\r\n        uint256 softcap;\r\n        uint256 minPurchase;\r\n        uint256 maxPurchase;\r\n        uint256 duration;\r\n        IVesting.VestingParams vestingParams;\r\n        address[] userWhitelist;\r\n        uint256[] userWhitelistMin;\r\n        uint256[] userWhitelistMax;\r\n        address unitOfAccount;\r\n        uint256 lockupDuration;\r\n        uint256 lockupTVL;\r\n        address whitelistAdmin;\r\n    }\r\n\r\n    function initialize(\r\n        address _service,\r\n        address _token,\r\n        uint256 _tokenId,\r\n        string memory _uri,\r\n        TGEInfo calldata _info,\r\n        uint256 _protocolFee,\r\n        address _fundReceiverAddress\r\n    ) external;\r\n\r\n    enum State {\r\n        Active,\r\n        Failed,\r\n        Successful\r\n    }\r\n\r\n    function token() external view returns (address);\r\n\r\n    function tokenId() external view returns (uint256);\r\n\r\n    function state() external view returns (State);\r\n\r\n    function getInfo() external view returns (TGEInfo memory);\r\n\r\n    function transferUnlocked() external view returns (bool);\r\n\r\n    function purchaseOf(address user) external view returns (uint256);\r\n\r\n    function redeemableBalanceOf(address user) external view returns (uint256);\r\n\r\n    function lockedBalanceOf(address account) external view returns (uint256);\r\n\r\n    function getEnd() external view returns (uint256);\r\n\r\n    function totalPurchased() external view returns (uint256);\r\n\r\n    function isERC1155TGE() external view returns (bool);\r\n\r\n    function purchase(uint256 amount) external payable;\r\n\r\n    function transferFunds() external;\r\n\r\n    function setWhitelist(\r\n        address[] memory accounts,\r\n        uint256[] memory mins,\r\n        uint256[] memory maxs\r\n    ) external;\r\n\r\n    function finishTGE() external;\r\n}\r\n"
      },
      "contracts/interfaces/ITGEFactory.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"./ITGE.sol\";\r\nimport \"./ITSE.sol\";\r\nimport \"./IToken.sol\";\r\nimport \"./governor/IGovernanceSettings.sol\";\r\n\r\ninterface ITGEFactory {\r\n    function createSecondaryTGE(\r\n        address token,\r\n        ITGE.TGEInfo calldata tgeInfo,\r\n        IToken.TokenInfo calldata tokenInfo,\r\n        string memory metadataURI,\r\n        address fundReceiverAddress\r\n    ) external;\r\n\r\n    function createSecondaryTGEERC1155(\r\n        address token,\r\n        uint256 tokenId,\r\n        string memory uri,\r\n        ITGE.TGEInfo calldata tgeInfo,\r\n        IToken.TokenInfo calldata tokenInfo,\r\n        string memory metadataURI,\r\n        address fundReceiverAddress\r\n    ) external;\r\n\r\n    function createPrimaryTGE(\r\n        address poolAddress,\r\n        IToken.TokenInfo memory tokenInfo,\r\n        ITGE.TGEInfo memory tgeInfo,\r\n        string memory metadataURI,\r\n        address fundReceiverAddress,\r\n        IGovernanceSettings.NewGovernanceSettings memory governanceSettings_,\r\n        Roles memory roles\r\n    ) external;\r\n\r\n    function createTSE(\r\n        address token,\r\n        uint256 tokenId,\r\n        ITSE.TSEInfo calldata tseInfo,\r\n        string memory metadataURI,\r\n        address recipient\r\n    ) external;\r\n\r\n    struct Roles {\r\n        address[] manager;\r\n        address[] secretary;\r\n        address[] executor;\r\n        address[] dividendManager;\r\n    }\r\n}"
      },
      "contracts/interfaces/ITSE.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"./IToken.sol\";\r\nimport \"./ITokenERC1155.sol\";\r\nimport \"./IVesting.sol\";\r\n\r\ninterface ITSE {\r\n    struct TSEInfo {\r\n        uint256 amount;\r\n        uint256 price;\r\n        uint256 minPurchase;\r\n        uint256 maxPurchase;\r\n        uint256 duration;\r\n        address[] userWhitelist;\r\n        uint256[] userWhitelistMin;\r\n        uint256[] userWhitelistMax;\r\n        address unitOfAccount;\r\n    }\r\n\r\n    function initialize(\r\n        address _token,\r\n        uint256 _tokenId,\r\n        TSEInfo calldata _info,\r\n        address _seller,\r\n        address _recipient\r\n    ) external;\r\n\r\n    enum State {\r\n        Active,\r\n        Failed,\r\n        Successful\r\n    }\r\n\r\n    function token() external view returns (address);\r\n\r\n    function tokenId() external view returns (uint256);\r\n\r\n    function state() external view returns (State);\r\n\r\n    function getInfo() external view returns (TSEInfo memory);\r\n\r\n    function purchaseOf(address user) external view returns (uint256);\r\n\r\n    function getEnd() external view returns (uint256);\r\n\r\n    function totalPurchased() external view returns (uint256);\r\n\r\n    function isERC1155TSE() external view returns (bool);\r\n\r\n    function purchase(uint256 amount) external payable;\r\n\r\n    function setWhitelist(\r\n        address[] memory accounts,\r\n        uint256[] memory mins,\r\n        uint256[] memory maxs\r\n    ) external;\r\n\r\n    function finishTSE() external;\r\n}\r\n"
      },
      "contracts/interfaces/IToken.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\r\nimport \"@openzeppelin/contracts-upgradeable/governance/utils/IVotesUpgradeable.sol\";\r\nimport \"./IService.sol\";\r\n\r\ninterface IToken is IVotesUpgradeable, IERC20Upgradeable {\r\n    /**\r\n     * @notice This structure is used to define the parameters of ERC20 tokens issued by the protocol for pools.\r\n     * @dev This structure is suitable for both Governance and Preference tokens if they are based on ERC20.\r\n     * @param tokenType Numeric code for the token type\r\n     * @param name Full name of the token\r\n     * @param symbol Ticker symbol (short name) of the token\r\n     * @param description Description of the token\r\n     * @param cap Maximum allowable token issuance\r\n     * @param decimals Number of decimal places for the token (precision)\r\n     */\r\n    struct TokenInfo {\r\n        TokenType tokenType;\r\n        string name;\r\n        string symbol;\r\n        string description;\r\n        uint256 cap;\r\n        uint8 decimals;\r\n    }\r\n    /**\r\n     * @notice Token type encoding\r\n     */\r\n    enum TokenType {\r\n        None,\r\n        Governance,\r\n        Preference\r\n    }\r\n\r\n    function initialize(\r\n        IService service_,\r\n        address pool_,\r\n        TokenInfo memory info,\r\n        address primaryTGE_\r\n    ) external;\r\n\r\n    function mint(address to, uint256 amount) external;\r\n\r\n    function burn(address from, uint256 amount) external;\r\n\r\n    function cap() external view returns (uint256);\r\n\r\n    function unlockedBalanceOf(address account) external view returns (uint256);\r\n\r\n    function pool() external view returns (address);\r\n\r\n    function service() external view returns (IService);\r\n\r\n    function decimals() external view returns (uint8);\r\n\r\n    function symbol() external view returns (string memory);\r\n\r\n    function compliance() external view returns (bytes32);\r\n\r\n    function tokenType() external view returns (TokenType);\r\n\r\n    function lastTGE() external view returns (address);\r\n\r\n    function getTGEList() external view returns (address[] memory);\r\n\r\n    function isPrimaryTGESuccessful() external view returns (bool);\r\n\r\n    function addTGE(address tge) external;\r\n\r\n    function addTSE(address account, address tse) external;\r\n\r\n    function setTGEVestedTokens(uint256 amount) external;\r\n\r\n    function setProtocolFeeReserved(uint256 amount) external;\r\n\r\n    function getTotalTGEVestedTokens() external view returns (uint256);\r\n\r\n    function getTotalProtocolFeeReserved() external view returns (uint256);\r\n\r\n    function totalSupplyWithReserves() external view returns (uint256);\r\n\r\n    function transferFrom(\r\n        address from,\r\n        address to,\r\n        uint256 amount\r\n    ) external returns (bool);\r\n\r\n    function transfer(address to, uint256 amount) external returns (bool);\r\n\r\n    function delegate(address delegatee) external;\r\n\r\n    function setCompliance(bytes32 compliance_) external;\r\n\r\n    function partnerFee() external view returns (uint256);\r\n\r\n    function partnerAddress() external view returns (address);\r\n\r\n    function depositDividends(\r\n        address tokenAddress,\r\n        uint256 amount\r\n    ) external payable;\r\n\r\n    function claimDividends(uint256 limit) external;\r\n}\r\n"
      },
      "contracts/interfaces/ITokenERC1155.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol\";\r\nimport \"./IService.sol\";\r\nimport \"./IToken.sol\";\r\n\r\ninterface ITokenERC1155 is IERC1155Upgradeable {\r\n    function initialize(\r\n        IService service_,\r\n        address pool_,\r\n        IToken.TokenInfo memory info,\r\n        address primaryTGE_\r\n    ) external;\r\n\r\n    function mint(address to, uint256 tokenId, uint256 amount) external;\r\n\r\n    function burn(address from, uint256 tokenId, uint256 amount) external;\r\n\r\n    function cap(uint256 tokenId) external view returns (uint256);\r\n\r\n    function unlockedBalanceOf(\r\n        address account,\r\n        uint256 tokenId\r\n    ) external view returns (uint256);\r\n\r\n    function pool() external view returns (address);\r\n\r\n    function service() external view returns (IService);\r\n\r\n    function decimals() external view returns (uint8);\r\n\r\n    function lastTokenId() external view returns (uint256);\r\n\r\n    function symbol() external view returns (string memory);\r\n\r\n    function tokenType() external view returns (IToken.TokenType);\r\n\r\n    function lastTGE(uint256 tokenId) external view returns (address);\r\n\r\n    function getTGEList(\r\n        uint256 tokenId\r\n    ) external view returns (address[] memory);\r\n\r\n    function isPrimaryTGESuccessful(\r\n        uint256 tokenId\r\n    ) external view returns (bool);\r\n\r\n    function addTGE(address tge, uint256 tokenId) external;\r\n\r\n    function addTSE(address account, uint256 tokenId, address tse) external;\r\n\r\n    function setTGEVestedTokens(uint256 amount, uint256 tokenId) external;\r\n\r\n    function setProtocolFeeReserved(uint256 amount, uint256 tokenId) external;\r\n\r\n    function getTotalTGEVestedTokens(\r\n        uint256 tokenId\r\n    ) external view returns (uint256);\r\n\r\n    function getTotalProtocolFeeReserved(\r\n        uint256 tokenId\r\n    ) external view returns (uint256);\r\n\r\n    function totalSupplyWithReserves(\r\n        uint256 tokenId\r\n    ) external view returns (uint256);\r\n\r\n    function setURI(uint256 tokenId, string memory tokenURI) external;\r\n\r\n    function setTokenIdCap(uint256 _tokenId, uint256 _cap) external;\r\n\r\n    function transfer(\r\n        address from,\r\n        address to,\r\n        uint256 tokenId,\r\n        uint256 amount\r\n    ) external;\r\n\r\n    function setLastTokenId(uint256 tokenId) external;\r\n\r\n    function setCompliance(bytes32 compliance_) external;\r\n\r\n    function partnerFee() external view returns (uint256);\r\n\r\n    function partnerAddress() external view returns (address);\r\n\r\n    function depositDividendsERC1155(\r\n        uint256 tokenId,\r\n        address tokenAddress,\r\n        uint256 amount\r\n    ) external payable;\r\n\r\n    function claimDividendsERC1155(\r\n        uint256 tokenId,\r\n        uint256 limit\r\n    ) external;\r\n}\r\n"
      },
      "contracts/interfaces/ITokenFactory.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\nimport \"./IToken.sol\";\nimport \"./ITokenERC1155.sol\";\n\ninterface ITokenFactory {\n    function createToken(\n        address pool,\n        IToken.TokenInfo memory info,\n        address primaryTGE\n    ) external returns (address token);\n\n    function createTokenERC1155(\n        address pool,\n        IToken.TokenInfo memory info,\n        address primaryTGE\n    ) external returns (address token);\n}\n"
      },
      "contracts/interfaces/IVesting.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ninterface IVesting {\r\n    /**\r\n     * @notice This interface describes a vesting program for tokens distributed within a specific TGE.\r\n     * @dev Such data is stored in the TGE contracts in the TGEInfo public info.\r\n     * @param vestedShare The percentage of tokens that participate in the vesting program (not distributed until conditions are met)\r\n     * @param cliff Cliff period (in blocks)\r\n     * @param cliffShare The portion of tokens that are distributed\r\n     * @param spans The number of periods for distributing the remaining tokens in vesting in equal shares\r\n     * @param spanDuration The duration of one such period (in blocks)\r\n     * @param spanShare The percentage of the total number of tokens in vesting that corresponds to one such period\r\n     * @param claimTVL The minimum required TVL of the pool after which it will be possible to claim tokens from vesting. Optional parameter (0 if this condition is not needed)\r\n     * @param resolvers A list of addresses that can cancel the vesting program for any address from the TGE participants list\r\n     */\r\n    struct VestingParams {\r\n        uint256 vestedShare;\r\n        uint256 cliff;\r\n        uint256 cliffShare;\r\n        uint256 spans;\r\n        uint256 spanDuration;\r\n        uint256 spanShare;\r\n        uint256 claimTVL;\r\n        address[] resolvers;\r\n    }\r\n\r\n    function vest(address to, uint256 amount) external;\r\n\r\n    function cancel(address tge, address account) external;\r\n\r\n    function validateParams(\r\n        VestingParams memory params\r\n    ) external pure returns (bool);\r\n\r\n    function vested(\r\n        address tge,\r\n        address account\r\n    ) external view returns (uint256);\r\n\r\n    function totalVested(address tge) external view returns (uint256);\r\n\r\n    function vestedBalanceOf(\r\n        address tge,\r\n        address account\r\n    ) external view returns (uint256);\r\n\r\n    function claim(address tge) external;\r\n}\r\n"
      },
      "contracts/interfaces/governor/IGovernanceSettings.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ninterface IGovernanceSettings {\r\n    /**\r\n     * @notice This structure specifies and stores the Governance settings for each individual pool.\r\n     * @dev More information on the thresholds (proposal, quorum, decision) and creating proposals can be found in the \"Other Entities\" section.\r\n     * @param proposalThreshold_ The proposal threshold (specified in token units with decimals taken into account)\r\n     * @param quorumThreshold_ The quorum threshold (specified as a percentage)\r\n     * @param decisionThreshold_ The decision threshold (specified as a percentage)\r\n     * @param votingDuration_ The duration of the voting period (specified in blocks)\r\n     * @param transferValueForDelay_ The minimum amount in USD for which a transfer from the pool wallet will be subject to a del\r\n     * @param executionDelays_ List of execution delays specified in blocks for different types of proposals\r\n     * @param votingStartDelay The delay before voting starts for newly created proposals, specified in blocks\r\n     */\r\n    struct NewGovernanceSettings {\r\n        uint256 proposalThreshold;\r\n        uint256 quorumThreshold;\r\n        uint256 decisionThreshold;\r\n        uint256 votingDuration;\r\n        uint256 transferValueForDelay;\r\n        uint256[4] executionDelays;\r\n        uint256 votingStartDelay;\r\n    }\r\n\r\n    function setGovernanceSettings(\r\n        NewGovernanceSettings memory settings\r\n    ) external;\r\n}\r\n"
      },
      "contracts/interfaces/governor/IGovernor.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"../../interfaces/registry/IRecordsRegistry.sol\";\r\n\r\ninterface IGovernor {\r\n    /**\r\n     * @notice Struct with proposal core data\r\n     * @dev This interface specifies the Governance settings that existed in the pool at the time of proposal creation, as well as the service data (to which addresses and with what messages and amounts of ETH should be sent) of the scenario that should be executed in case of a positive voting outcome.\r\n     * @param targets A list of addresses to be called in case of a positive voting outcome\r\n     * @param values The amounts of wei to be sent to the addresses from targets\r\n     * @param callDatas The 'calldata' messages to be attached to transactions\r\n     * @param quorumThreshold The quorum, expressed as a percentage with DENOM taken into account\r\n     * @param decisionThreshold The decision-making threshold, expressed as a percentage with DENOM taken into account\r\n     * @param executionDelay The number of blocks that must pass since the creation of the proposal for it to be considered launched\r\n     */\r\n    struct ProposalCoreData {\r\n        address[] targets;\r\n        uint256[] values;\r\n        bytes[] callDatas;\r\n        uint256 quorumThreshold;\r\n        uint256 decisionThreshold;\r\n        uint256 executionDelay;\r\n    }\r\n\r\n    /**\r\n     * @notice This interface specifies information about the subject of the voting, intended for human perception.\r\n     * @dev Struct with proposal metadata\r\n     * @param proposalType The digital code of the proposal type\r\n     * @param description The public description of the proposal\r\n     * @param metaHash The identifier of the private proposal description stored on the backend\r\n     */\r\n    struct ProposalMetaData {\r\n        IRecordsRegistry.EventType proposalType;\r\n        string description;\r\n        string metaHash;\r\n    }\r\n\r\n    function proposalState(uint256 proposalId)\r\n        external\r\n        view\r\n        returns (uint256 state);\r\n}\r\n"
      },
      "contracts/interfaces/governor/IGovernorProposals.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\nimport \"../IService.sol\";\n\ninterface IGovernorProposals {\n    function service() external view returns (IService);\n}\n"
      },
      "contracts/interfaces/registry/ICompaniesRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"../ITGE.sol\";\r\nimport \"../IToken.sol\";\r\n\r\ninterface ICompaniesRegistry {\r\n    /**\r\n    * @notice This is how immutable data about companies is stored\r\n    * @dev For companies listed for sale, this data is stored in the Registry in mapping(uint256 => CompanyInfo) public companies. Additionally, this data is duplicated in the Pool contract in IRegistry.CompanyInfo public companyInfo.\r\n    * @param jurisdiction Numeric code for the jurisdiction (region where the company is registered)\r\n    * @param entityType Numeric code for the type of organization\r\n    * @param ein Unique registration number (uniqueness is checked within a single jurisdiction)\r\n    * @param dateOfIncorporation Date of company registration (in the format provided by the jurisdiction)\r\n    * @param fee Fost of the company in wei ETH\r\n    */ \r\n    struct CompanyInfo {\r\n        uint256 jurisdiction;\r\n        uint256 entityType;\r\n        string ein;\r\n        string dateOfIncorporation;\r\n        uint256 fee;\r\n    }\r\n\r\n    function lockCompany(\r\n        uint256 jurisdiction,\r\n        uint256 entityType\r\n    ) external returns (CompanyInfo memory);\r\n\r\n    function createCompany(\r\n        CompanyInfo calldata info\r\n    ) external;\r\n}\r\n"
      },
      "contracts/interfaces/registry/IRecordsRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\ninterface IRecordsRegistry {\r\n    /**\r\n     * @notice In the section of the Registry contract that contains records of the type of deployed user contract, the following numeric encoding of contract types is used.\r\n     * @dev TGE is both a type of user contract and an event for which the contract was deployed.\r\n     **/\r\n    enum ContractType {\r\n        None,\r\n        Pool,\r\n        GovernanceToken,\r\n        PreferenceToken,\r\n        TGE\r\n    }\r\n    /**\r\n     * @notice Encoding of the registered event type\r\n     */\r\n    enum EventType {\r\n        None,\r\n        Transfer,\r\n        TGE,\r\n        GovernanceSettings\r\n    }\r\n\r\n    /**\r\n     * @notice This structure is used for contracts storing in the CompanyDAO ecosystem.\r\n     * @dev The Registry contract stores data about deployed user contracts in `ContractInfo[] public contractRecords`, where records receive a sequential and pool-independent numbering.\r\n     * @param addr Deployed contract address\r\n     * @param contractType Digital code of contract type\r\n     * @param description Contract description\r\n     */\r\n    struct ContractInfo {\r\n        address addr;\r\n        ContractType contractType;\r\n        string description;\r\n    }\r\n\r\n    /**\r\n     * @notice Using this data, you can refer to the contract of a specific pool to get more detailed information about the proposal.\r\n     * @dev The Registry contract stores data about proposals launched by users in `ProposalInfo[] public proposalRecords`, where records receive a sequential and pool-independent numbering.\r\n     * @param pool Pool contract in which the proposal was launched\r\n     * @param proposalId Internal proposal identifier for the pool\r\n     * @param description Proposal description\r\n     */\r\n    struct ProposalInfo {\r\n        address pool;\r\n        uint256 proposalId;\r\n        string description;\r\n    }\r\n\r\n    /**\r\n     * @dev The Registry contract stores data about all events that have taken place in `Event[] public events`, where records receive a sequential and pool-independent numbering.\r\n     * @param eventType Code of event type\r\n     * @param pool Address of the pool to which this event relates\r\n     * @param eventContract Address of the event contract, if the event type implies the deployment of a separate contract\r\n     * @param proposalId Internal proposal identifier for the pool, the execution of which led to the launch of this event\r\n     * @param metaHash Hash identifier of the private description stored on the backend\r\n     */\r\n    struct Event {\r\n        EventType eventType;\r\n        address pool;\r\n        address eventContract;\r\n        uint256 proposalId;\r\n        string metaHash;\r\n    }\r\n\r\n    function addContractRecord(\r\n        address addr,\r\n        ContractType contractType,\r\n        string memory description\r\n    ) external returns (uint256 index);\r\n\r\n    function addProposalRecord(\r\n        address pool,\r\n        uint256 proposalId\r\n    ) external returns (uint256 index);\r\n\r\n    function addEventRecord(\r\n        address pool,\r\n        EventType eventType,\r\n        address eventContract,\r\n        uint256 proposalId,\r\n        string calldata metaHash\r\n    ) external returns (uint256 index);\r\n\r\n    function typeOf(address addr) external view returns (ContractType);\r\n}\r\n"
      },
      "contracts/interfaces/registry/IRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"./ICompaniesRegistry.sol\";\r\nimport \"./ITokensRegistry.sol\";\r\nimport \"./IRecordsRegistry.sol\";\r\nimport \"../IService.sol\";\r\n\r\ninterface IRegistry is ITokensRegistry, ICompaniesRegistry, IRecordsRegistry {\r\n    function service() external view returns (IService);\r\n\r\n    function COMPANIES_MANAGER_ROLE() external view returns (bytes32);\r\n\r\n    function hasRole(\r\n        bytes32 role,\r\n        address account\r\n    ) external view returns (bool);\r\n\r\n    function log(\r\n        address sender,\r\n        address receiver,\r\n        uint256 value,\r\n        bytes memory data\r\n    ) external;\r\n\r\n    function getPoolAddressByIndex(uint256 index) external view returns (address);\r\n\r\n    function getAvailableCompanyAddress(\r\n        uint256 jurisdiction,\r\n        uint256 entityType\r\n    ) external view returns (address);\r\n}"
      },
      "contracts/interfaces/registry/ITokensRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\ninterface ITokensRegistry {\n    function isTokenWhitelisted(address token) external view returns (bool);\n}\n"
      },
      "contracts/libraries/ExceptionsLibrary.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nlibrary ExceptionsLibrary {\r\n    string public constant ADDRESS_ZERO = \"ADDRESS_ZERO\";\r\n    string public constant INCORRECT_ETH_PASSED = \"INCORRECT_ETH_PASSED\";\r\n    string public constant NO_COMPANY = \"NO_COMPANY\";\r\n    string public constant INVALID_TOKEN = \"INVALID_TOKEN\";\r\n    string public constant NOT_POOL = \"NOT_POOL\";\r\n    string public constant NOT_TGE = \"NOT_TGE\";\r\n    string public constant NOT_Registry = \"NOT_Registry\";\r\n    string public constant NOT_POOL_OWNER = \"NOT_POOL_OWNER\";\r\n    string public constant NOT_SERVICE_OWNER = \"NOT_SERVICE_OWNER\";\r\n    string public constant IS_DAO = \"IS_DAO\";\r\n    string public constant NOT_DAO = \"NOT_DAO\";\r\n    string public constant NOT_WHITELISTED = \"NOT_WHITELISTED\";\r\n    string public constant NOT_SERVICE = \"NOT_SERVICE\";\r\n    string public constant WRONG_STATE = \"WRONG_STATE\";\r\n    string public constant TRANSFER_FAILED = \"TRANSFER_FAILED\";\r\n    string public constant CLAIM_NOT_AVAILABLE = \"CLAIM_NOT_AVAILABLE\";\r\n    string public constant NO_LOCKED_BALANCE = \"NO_LOCKED_BALANCE\";\r\n    string public constant LOCKUP_TVL_REACHED = \"LOCKUP_TVL_REACHED\";\r\n    string public constant HARDCAP_OVERFLOW = \"HARDCAP_OVERFLOW\";\r\n    string public constant MAX_PURCHASE_OVERFLOW = \"MAX_PURCHASE_OVERFLOW\";\r\n    string public constant HARDCAP_OVERFLOW_REMAINING_SUPPLY =\r\n        \"HARDCAP_OVERFLOW_REMAINING_SUPPLY\";\r\n    string public constant HARDCAP_AND_PROTOCOL_FEE_OVERFLOW_REMAINING_SUPPLY =\r\n        \"HARDCAP_AND_PROTOCOL_FEE_OVERFLOW_REMAINING_SUPPLY\";\r\n    string public constant MIN_PURCHASE_UNDERFLOW = \"MIN_PURCHASE_UNDERFLOW\";\r\n    string public constant LOW_UNLOCKED_BALANCE = \"LOW_UNLOCKED_BALANCE\";\r\n    string public constant ZERO_PURCHASE_AMOUNT = \"ZERO_PURCHASE_AMOUNTs\";\r\n    string public constant NOTHING_TO_REDEEM = \"NOTHING_TO_REDEEM\";\r\n    string public constant RECORD_IN_USE = \"RECORD_IN_USE\";\r\n    string public constant INVALID_EIN = \"INVALID_EIN\";\r\n    string public constant VALUE_ZERO = \"VALUE_ZERO\";\r\n    string public constant ALREADY_SET = \"ALREADY_SET\";\r\n    string public constant VOTING_FINISHED = \"VOTING_FINISHED\";\r\n    string public constant ALREADY_EXECUTED = \"ALREADY_EXECUTED\";\r\n    string public constant ACTIVE_TGE_EXISTS = \"ACTIVE_TGE_EXISTS\";\r\n    string public constant INVALID_VALUE = \"INVALID_VALUE\";\r\n    string public constant INVALID_CAP = \"INVALID_CAP\";\r\n    string public constant INVALID_HARDCAP = \"INVALID_HARDCAP\";\r\n    string public constant ONLY_POOL = \"ONLY_POOL\";\r\n    string public constant ETH_TRANSFER_FAIL = \"ETH_TRANSFER_FAIL\";\r\n    string public constant TOKEN_TRANSFER_FAIL = \"TOKEN_TRANSFER_FAIL\";\r\n    string public constant SERVICE_PAUSED = \"SERVICE_PAUSED\";\r\n    string public constant INVALID_PROPOSAL_TYPE = \"INVALID_PROPOSAL_TYPE\";\r\n    string public constant EXECUTION_FAILED = \"EXECUTION_FAILED\";\r\n    string public constant INVALID_USER = \"INVALID_USER\";\r\n    string public constant NOT_LAUNCHED = \"NOT_LAUNCHED\";\r\n    string public constant LAUNCHED = \"LAUNCHED\";\r\n    string public constant VESTING_TVL_REACHED = \"VESTING_TVL_REACHED\";\r\n    string public constant WRONG_TOKEN_ADDRESS = \"WRONG_TOKEN_ADDRESS\";\r\n    string public constant GOVERNANCE_TOKEN_EXISTS = \"GOVERNANCE_TOKEN_EXISTS\";\r\n    string public constant THRESHOLD_NOT_REACHED = \"THRESHOLD_NOT_REACHED\";\r\n    string public constant UNSUPPORTED_TOKEN_TYPE = \"UNSUPPORTED_TOKEN_TYPE\";\r\n    string public constant ALREADY_VOTED = \"ALREADY_VOTED\";\r\n    string public constant ZERO_VOTES = \"ZERO_VOTES\";\r\n    string public constant ACTIVE_GOVERNANCE_SETTINGS_PROPOSAL_EXISTS =\r\n        \"ACTIVE_GOVERNANCE_SETTINGS_PROPOSAL_EXISTS\";\r\n    string public constant EMPTY_ADDRESS = \"EMPTY_ADDRESS\";\r\n    string public constant NOT_VALID_PROPOSER = \"NOT_VALID_PROPOSER\";\r\n    string public constant SHARES_SUM_EXCEEDS_ONE = \"SHARES_SUM_EXCEEDS_ONE\";\r\n    string public constant NOT_RESOLVER = \"NOT_RESOLVER\";\r\n    string public constant NOT_REGISTRY = \"NOT_REGISTRY\";\r\n    string public constant INVALID_TARGET = \"INVALID_TARGET\";\r\n    string public constant NOT_TGE_FACTORY = \"NOT_TGE_FACTORY\";\r\n    string public constant WRONG_AMOUNT = \"WRONG_AMOUNT\";\r\n    string public constant WRONG_BLOCK_NUMBER = \"WRONG_BLOCK_NUMBER\";\r\n    string public constant NOT_VALID_EXECUTOR = \"NOT_VALID_EXECUTOR\";\r\n    string public constant POOL_PAUSED = \"POOL_PAUSED\";\r\n    string public constant NOT_INVOICE_MANAGER = \"NOT_INVOICE_MANAGER\";\r\n    string public constant WRONG_RESOLVER = \"WRONG_RESOLVER\";\r\n    string public constant INVALID_PURCHASE_AMOUNT = \"INVALID_PURCHASE_AMOUNT\";\r\n    string public constant NOT_SERVICE_ADMIN = \"NOT_SERVICE_ADMIN\";\r\n}\r\n"
      },
      "contracts/registry/CompaniesRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"./RegistryBase.sol\";\r\nimport \"../libraries/ExceptionsLibrary.sol\";\r\nimport \"../interfaces/IService.sol\";\r\nimport \"../interfaces/IPool.sol\";\r\nimport \"../interfaces/registry/ICompaniesRegistry.sol\";\r\nimport \"../utils/Logger.sol\";\r\n\r\n/**\r\n *@title Companies Registry Contract\r\n *@notice This contract is a section of the Registry contract designed for storing and manipulating companies listed for sale.\r\n *@dev With the help of this contract, one can find out the number of companies available for purchase in a specific jurisdiction and their corresponding prices. Here, an isolated but still dependent role-based model based on Access Control from OZ is implemented, with the contract Service playing a crucial role.\r\n */\r\nabstract contract CompaniesRegistry is\r\n    RegistryBase,\r\n    ICompaniesRegistry,\r\n    Logger\r\n{\r\n    // CONSTANTS\r\n\r\n    /**\r\n    * @notice Hash code for the COMPANIES_MANAGER role in the OpenZeppelin (OZ) Access Control model.\r\n    * @dev This role is intended for working with the showcase of companies available for purchase and can also add and modify the link to the organization's charter. It operates only within the Registry contract through a separate AccessControl model from OpenZeppelin with standard methods: grantRole, revokeRole, setRole.\r\n    Methods:\r\n    - CompaniesRegistry.sol:createCompany(CompanyInfo calldata info) - creating a company with specified immutable data and its price in ETH, deploying the contract with a temporary owner in the form of the Registry contract proxy address. After calling such a method, the company immediately becomes available for purchase.\r\n    - CompaniesRegistry.sol:deleteCompany(uint256 jurisdiction, uint256 entityType, uint256 id) - deleting a company record (removing it from sale without the possibility of recovery).\r\n    - Pool.sol:setOAUrl(string memory _uri) - changing the link to the pool's operating agreement.\r\n    Storage, assignment, and revocation of the role are carried out using the standard methods of the AccessControl model from OpenZeppelin: grantRole, revokeRole, setRole. The holder of the standard ADMIN_ROLE of this contract can manage this role (by default - the address that deployed the contract).\r\n    */\r\n    bytes32 public constant COMPANIES_MANAGER_ROLE =\r\n        keccak256(\"COMPANIES_MANAGER\");\r\n\r\n    // STORAGE\r\n\r\n    /// @dev The embedded mappings form a construction, when accessed using two keys at once [jurisdiction][EntityType], you can get lists of ordinal numbers of company records added by managers. These serial numbers can be used when contacting mapping companies to obtain public legal information about the company awaiting purchase by the client.\r\n    mapping(uint256 => mapping(uint256 => uint256[])) public queue;\r\n\r\n    /// @dev In this mapping, public legal information is stored about companies that are ready to be acquired by the client and start working as a DAO. The appeal takes place according to the serial number - the key. A list of keys for each type of company and each jurisdiction can be obtained in the queue mapping.\r\n    mapping(uint256 => CompanyInfo) public companies;\r\n\r\n    /// @dev The last sequential number of the last record created by managers in the queue with company data is stored here.\r\n    uint256 public lastCompanyIndex;\r\n\r\n    /// @dev Status of combination of (jurisdiction, entityType, EIN) existing\r\n    mapping(bytes32 => uint256) public companyIndex;\r\n\r\n    // EVENTS\r\n\r\n    /**\r\n     * @dev An event emitted when a manager creates a new company. After this event, the company immediately becomes available for purchase.\r\n     * @param index Company list index.\r\n     * @param poolAddress The contract pool address computed based on the bytecode and initial arguments.\r\n     */\r\n    event CompanyCreated(uint256 index, address poolAddress);\r\n\r\n    /**\r\n     * @dev An event emitted when a company is delisted from sale. This is one of the mechanisms to modify legal information regarding the company.\r\n     * @param metadataIndex Company metadata index.\r\n     */\r\n    event CompanyDeleted(uint256 metadataIndex);\r\n\r\n    /**\r\n     * @dev The event is issued when the manager changes the price of an already created company ready for purchase by the client.\r\n     * @param jurisdiction The digital code of the jurisdiction.\r\n     * @param entityType The digital code of the organization type.\r\n     * @param id Queue index\r\n     * @param fee Fee for createPool\r\n     */\r\n    event CompanyFeeUpdated(\r\n        uint256 jurisdiction,\r\n        uint256 entityType,\r\n        uint256 id,\r\n        uint256 fee\r\n    );\r\n\r\n    // PUBLIC FUNCTIONS\r\n\r\n    /**\r\n     * @dev Create company record - A method for creating a new company record, including its legal data and the sale price.\r\n     * @param info Company Info\r\n     */\r\n    function createCompany(\r\n        CompanyInfo calldata info\r\n    ) public onlyRole(COMPANIES_MANAGER_ROLE) {\r\n        // Check that company data is valid\r\n        require(\r\n            info.jurisdiction > 0 &&\r\n                bytes(info.ein).length != 0 &&\r\n                bytes(info.dateOfIncorporation).length != 0 &&\r\n                info.entityType > 0,\r\n            ExceptionsLibrary.VALUE_ZERO\r\n        );\r\n\r\n        // Check that such company does not exist yet and mark it as existing\r\n        bytes32 companyHash = keccak256(\r\n            abi.encodePacked(info.jurisdiction, info.entityType, info.ein)\r\n        );\r\n        require(companyIndex[companyHash] == 0, ExceptionsLibrary.INVALID_EIN);\r\n        uint256 index = ++lastCompanyIndex;\r\n        companyIndex[companyHash] = index;\r\n\r\n        // Add record to list\r\n        companies[index] = info;\r\n\r\n        //Create PoolContract\r\n        address poolAddress = IService(service).createPool(info);\r\n\r\n        // Emit event\r\n        emit CompanyCreated(index, poolAddress);\r\n\r\n        _setIndexAddress(index, poolAddress);\r\n\r\n        emit CompanyDAOLog(\r\n            msg.sender,\r\n            address(this),\r\n            0,\r\n            abi.encodeWithSelector(\r\n                ICompaniesRegistry.createCompany.selector,\r\n                info\r\n            ),\r\n            service\r\n        );\r\n    }\r\n\r\n    function updateCompanyInfo(\r\n        uint256 index,\r\n        CompanyInfo memory _info\r\n    ) public onlyRole(COMPANIES_MANAGER_ROLE) {\r\n        address companyAddress = IRegistry(address(this)).getPoolAddressByIndex(\r\n            index\r\n        );\r\n\r\n        _setCompanyInfoForPool(\r\n            address(companyAddress),\r\n            _info.fee,\r\n            _info.jurisdiction,\r\n            _info.entityType,\r\n            _info.ein\r\n        );\r\n\r\n        companies[index] = _info;\r\n    }\r\n\r\n    function activateCompany(\r\n        uint256 index\r\n    ) public onlyRole(COMPANIES_MANAGER_ROLE) {\r\n        queue[companies[index].jurisdiction][companies[index].entityType].push(\r\n            index\r\n        );\r\n    }\r\n\r\n    /**\r\n     * @notice Lock company record\r\n     * @dev Booking the company for the buyer. During the acquisition of a company, this method searches for a free company at the request of the client (jurisdiction and type of organization), if such exist in the company’s storage reserve, then the method selects the last of the added companies, extracts its record data and sends it as a response for further work of the Service contract, removes its record from the Registry.\r\n     * @param jurisdiction Цифровой код юрисдикции\r\n     * @param entityType Цифровой код типа организакции\r\n     * @return info Company info\r\n     */\r\n    function lockCompany(\r\n        uint256 jurisdiction,\r\n        uint256 entityType\r\n    ) external onlyService returns (CompanyInfo memory info) {\r\n        // Check that company is available\r\n        uint256 queueLength = queue[jurisdiction][entityType].length;\r\n        require(queueLength > 0, ExceptionsLibrary.NO_COMPANY);\r\n\r\n        // Get index and pop queue\r\n        uint256 index = queue[jurisdiction][entityType][queueLength - 1];\r\n        queue[jurisdiction][entityType].pop();\r\n\r\n        // Get company info and remove it from list\r\n        info = companies[index];\r\n        delete companies[index];\r\n    }\r\n\r\n    /**\r\n     * @dev This method removes a record from the queue of created companies.\r\n     * @param jurisdiction The digital code of the jurisdiction.\r\n     * @param entityType The digital code of the organization type.\r\n     * @param id Queue index.\r\n     */\r\n    function deleteCompany(\r\n        uint256 jurisdiction,\r\n        uint256 entityType,\r\n        uint256 id\r\n    ) external onlyRole(COMPANIES_MANAGER_ROLE) {\r\n        // Get index and pop queue\r\n        uint256 index = queue[jurisdiction][entityType][id];\r\n        uint256 lastId = queue[jurisdiction][entityType].length - 1;\r\n        queue[jurisdiction][entityType][id] = queue[jurisdiction][entityType][\r\n            lastId\r\n        ];\r\n        queue[jurisdiction][entityType].pop();\r\n\r\n        // Remove company from list\r\n        string memory ein = companies[index].ein;\r\n        delete companies[index];\r\n\r\n        // Mark company as not existing\r\n        bytes32 companyHash = keccak256(\r\n            abi.encodePacked(jurisdiction, entityType, ein)\r\n        );\r\n        companyIndex[companyHash] = 0;\r\n\r\n        // Emit event\r\n        emit CompanyDeleted(id);\r\n    }\r\n\r\n    /**\r\n     * @dev The method that the manager uses to change the value of the company already added earlier in the Registry.\r\n     * @param jurisdiction The digital code of the jurisdiction.\r\n     * @param entityType The digital code of the organization type.\r\n     * @param id Queue index.\r\n     *@ param fee Fee to update.\r\n     */\r\n\r\n    // PUBLIC VIEW FUNCTIONS\r\n\r\n    /**\r\n     * @dev This view method is designed to find out whether there is at least one company available for purchase for the jurisdiction and type of organization selected by the user.\r\n     * @param jurisdiction The digital code of the jurisdiction.\r\n     * @param entityType The digital code of the organization type.\r\n     * @return \"True\" if at least one company is available\r\n     */\r\n    function companyAvailable(\r\n        uint256 jurisdiction,\r\n        uint256 entityType\r\n    ) external view returns (bool) {\r\n        return queue[jurisdiction][entityType].length > 0;\r\n    }\r\n\r\n    /**\r\n     * @dev This method allows obtaining all the data of a company, including its legal data, that is still available for sale.\r\n     * @param jurisdiction The digital code of the jurisdiction.\r\n     * @param entityType The digital code of the organization type.\r\n     * @param ein The government registration number.\r\n     * @return CompanyInfo The company data.\r\n     */\r\n    function getCompany(\r\n        uint256 jurisdiction,\r\n        uint256 entityType,\r\n        string calldata ein\r\n    ) external view returns (CompanyInfo memory) {\r\n        bytes32 companyHash = keccak256(\r\n            abi.encodePacked(jurisdiction, entityType, ein)\r\n        );\r\n        return companies[companyIndex[companyHash]];\r\n    }\r\n\r\n    /**\r\n     * @dev This method allows obtaining the contract address of a company that is available for sale and meets the conditions based on its jurisdiction and entity type.\r\n     * @param jurisdiction The digital code of the jurisdiction.\r\n     * @param entityType The digital code of the organization type.\r\n     * @return address The contract pool address.\r\n     */\r\n    function getAvailableCompanyAddress(\r\n        uint256 jurisdiction,\r\n        uint256 entityType\r\n    ) external view returns (address) {\r\n        // Check that company is available\r\n        uint256 queueLength = queue[jurisdiction][entityType].length;\r\n        require(queueLength > 0, ExceptionsLibrary.NO_COMPANY);\r\n\r\n        // Get index\r\n        uint256 index = queue[jurisdiction][entityType][queueLength - 1];\r\n\r\n        address companyAddress = IRegistry(address(this)).getPoolAddressByIndex(\r\n            index\r\n        );\r\n\r\n        return companyAddress;\r\n    }\r\n\r\n    function _setIndexAddress(\r\n        uint256 index,\r\n        address poolAddress\r\n    ) internal virtual;\r\n\r\n    /**\r\n     * @notice Method for replacing the reference to the Operating Agreement and legal data of a company in the contract's memory.\r\n     * @dev This is a special method for the manager to service contracts of already acquired companies. To correct data in a company that has not been acquired yet, the record should be deleted and a new one created.\r\n     * @param _pool The contract pool address.\r\n     * @param _jurisdiction The digital code of the jurisdiction.\r\n     * @param _entityType The digital code of the organization type.\r\n     * @param _ein The government registration number\r\n     */\r\n    function _setCompanyInfoForPool(\r\n        address _pool,\r\n        uint256 _fee,\r\n        uint256 _jurisdiction,\r\n        uint256 _entityType,\r\n        string memory _ein\r\n    ) private onlyRole(COMPANIES_MANAGER_ROLE) {\r\n        require(\r\n            bytes(IPool(_pool).trademark()).length == 0,\r\n            ExceptionsLibrary.ALREADY_SET\r\n        );\r\n\r\n        IPool(_pool).setCompanyInfo(_fee, _jurisdiction, _entityType, _ein);\r\n    }\r\n}\r\n"
      },
      "contracts/registry/RecordsRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"./RegistryBase.sol\";\r\nimport \"../interfaces/registry/IRecordsRegistry.sol\";\r\n/**\r\n*  @title Registry Contract\r\n*  @notice This contract complements the Registry and serves as a storage or all entities created by users of the protocol.\r\n* @dev Unlike the Companies Registry, this contract is managed solely by other protocol contracts without operator intervention, and logs all deployed contracts and their associated events.\r\n*/\r\nabstract contract RecordsRegistry is RegistryBase, IRecordsRegistry {\r\n    // STORAGE\r\n\r\n    /// @dev In this array, records are stored about all contracts created by users (that is, about those generated by the service), namely, its index, with which you can extract all available information from other getters.\r\n    ContractInfo[] public contractRecords;\r\n\r\n    struct ContractIndex {\r\n        bool exists;\r\n        uint160 index;\r\n    }\r\n\r\n    /// @dev Mapping of contract addresses to their record indexes\r\n    mapping(address => ContractIndex) public indexOfContract;\r\n\r\n    /// @dev List of proposal records\r\n    ProposalInfo[] public proposalRecords;\r\n\r\n    /// @dev A list of existing events. An event can be either a contract or a specific action performed by a pool based on the results of voting for a promotion (for example, the transfer of funds from a pool contract is considered an event, but does not have a contract, and TGE has both the status of an event and its own separate contract).\r\n    Event[] public events;\r\n\r\n    // EVENTS\r\n\r\n    /**\r\n     * @dev Event emitted on creation of contract record\r\n     * @param index Record index\r\n     * @param addr Contract address\r\n     * @param contractType Contract type\r\n     */\r\n    event ContractRecordAdded(\r\n        uint256 index,\r\n        address addr,\r\n        ContractType contractType\r\n    );\r\n\r\n    /**\r\n     * @dev Event emitted on creation of proposal record\r\n     * @param index Record index\r\n     * @param pool Pool address\r\n     * @param proposalId Proposal ID\r\n     */\r\n    event ProposalRecordAdded(uint256 index, address pool, uint256 proposalId);\r\n\r\n    /**\r\n     * @dev Event emitted on creation of event\r\n     * @param index Record index\r\n     * @param eventType Event type\r\n     * @param pool Pool address\r\n     * @param proposalId Proposal ID\r\n     */\r\n    event EventRecordAdded(\r\n        uint256 index,\r\n        EventType eventType,\r\n        address pool,\r\n        uint256 proposalId\r\n    );\r\n\r\n    // PUBLIC FUNCTIONS\r\n\r\n    /**\r\n     * @dev This method is used by the main Service contract in order to save the data of the contracts it deploys. After the Registry contract receives the address and type of the created contract from the Service contract, it sends back as a response the sequence number/index assigned to the new record.\r\n     * @param addr Contract address\r\n     * @param contractType Contract type\r\n     * @return index Record index\r\n     */\r\n    function addContractRecord(\r\n        address addr,\r\n        ContractType contractType,\r\n        string memory description\r\n    ) external onlyServiceOrFactory returns (uint256 index) {\r\n        // Add record\r\n        contractRecords.push(\r\n            ContractInfo({\r\n                addr: addr,\r\n                contractType: contractType,\r\n                description: description\r\n            })\r\n        );\r\n        index = contractRecords.length - 1;\r\n\r\n        // Add mapping from contract address\r\n        indexOfContract[addr] = ContractIndex({\r\n            exists: true,\r\n            index: uint160(index)\r\n        });\r\n\r\n        // Emit event\r\n        emit ContractRecordAdded(index, addr, contractType);\r\n    }\r\n\r\n    /**\r\n     * @dev This method accepts data from the Service contract about the created nodes in the pools. If there is an internal index of the proposal in the contract of the pool whose shareholders created the proposal, then as a result of using this method, the proposal is given a global index for the entire ecosystem.\r\n     * @param pool Pool address\r\n     * @param proposalId Proposal ID\r\n     * @return index Record index\r\n     */\r\n    function addProposalRecord(\r\n        address pool,\r\n        uint256 proposalId\r\n    ) external onlyService returns (uint256 index) {\r\n        // Add record\r\n        proposalRecords.push(\r\n            ProposalInfo({pool: pool, proposalId: proposalId, description: \"\"})\r\n        );\r\n        index = proposalRecords.length - 1;\r\n        setGlobalProposalId(pool, proposalId, index);\r\n        // Emit event\r\n        emit ProposalRecordAdded(index, pool, proposalId);\r\n    }\r\n\r\n    /**\r\n     * @dev This method is used to register events - specific entities associated with the operational activities of pools and the transfer of various values as a result of the use of ecosystem contracts. Each event also has a metahash string field, which is the identifier of the private description of the event stored on the backend.\r\n     * @param pool Pool address\r\n     * @param eventType Event type\r\n     * @param eventContract Address of the event contract\r\n     * @param proposalId Proposal ID\r\n     * @param metaHash Hash value of event metadata\r\n     * @return index Record index\r\n     */\r\n    function addEventRecord(\r\n        address pool,\r\n        EventType eventType,\r\n        address eventContract,\r\n        uint256 proposalId,\r\n        string calldata metaHash\r\n    ) external onlyServiceOrFactory returns (uint256 index) {\r\n        // Add record\r\n        events.push(\r\n            Event({\r\n                eventType: eventType,\r\n                pool: pool,\r\n                eventContract: eventContract,\r\n                proposalId: proposalId,\r\n                metaHash: metaHash\r\n            })\r\n        );\r\n        index = events.length - 1;\r\n\r\n        // Emit event\r\n        emit EventRecordAdded(index, eventType, pool, proposalId);\r\n    }\r\n\r\n    // VIRTUAL FUNCTIONS\r\n\r\n    function setGlobalProposalId(\r\n        address pool,\r\n        uint256 proposalId,\r\n        uint256 globalProposalId\r\n    ) internal virtual;\r\n\r\n    // PUBLIC VIEW FUNCTIONS\r\n\r\n    /**\r\n     * @notice Returns type of given contract\r\n     * @param addr Address of contract\r\n     * @return Contract type\r\n     */\r\n    function typeOf(address addr) public view returns (ContractType) {\r\n        ContractIndex memory index = indexOfContract[addr];\r\n        return\r\n            index.exists\r\n                ? contractRecords[index.index].contractType\r\n                : ContractType.None;\r\n    }\r\n\r\n    /**\r\n     * @notice Returns number of contract records\r\n     * @return Contract records count\r\n     */\r\n    function contractRecordsCount() external view returns (uint256) {\r\n        return contractRecords.length;\r\n    }\r\n\r\n    /**\r\n     * @notice Returns number of proposal records\r\n     * @return Proposal records count\r\n     */\r\n    function proposalRecordsCount() external view returns (uint256) {\r\n        return proposalRecords.length;\r\n    }\r\n\r\n    /**\r\n     * @notice Returns number of event records\r\n     * @return Event records count\r\n     */\r\n    function eventRecordsCount() external view returns (uint256) {\r\n        return events.length;\r\n    }\r\n}\r\n"
      },
      "contracts/registry/RegistryBase.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nimport \"@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol\";\r\nimport \"../libraries/ExceptionsLibrary.sol\";\r\nimport \"../interfaces/IService.sol\";\r\n/**\r\n* @title Registry Base Contract\r\n* @notice The core contract for the Registry contracts.\r\n* @dev This abstract contract is inherited by the Registry contract and contains functions and modifiers that could be applied to all contracts in this section.\r\n*/\r\nabstract contract RegistryBase is AccessControlEnumerableUpgradeable {\r\n    // STORAGE\r\n\r\n    /// @dev The address of the Service contract.\r\n    address public service;\r\n\r\n    // MODIFIERS\r\n    /// @notice Modifier that allows calling the method only from the Service contract.\r\n    modifier onlyService() {\r\n        require(msg.sender == service, ExceptionsLibrary.NOT_SERVICE);\r\n        _;\r\n    }\r\n    /// @notice Modifier that allows calling the method only from the Service, TGEFactory, and TokenFactory contracts.\r\n    modifier onlyServiceOrFactory() {\r\n        bool isService = msg.sender == service;\r\n        bool isFactory = msg.sender ==\r\n            address(IService(service).tokenFactory()) ||\r\n            msg.sender == address(IService(service).tgeFactory());\r\n\r\n        require(isService || isFactory, ExceptionsLibrary.NOT_SERVICE);\r\n        _;\r\n    }\r\n\r\n    // INITIALIZER\r\n    /// @dev This method is executed during deployment or upgrade of the contract to set the contract initiator as the contract administrator. Without binding from the Service contract, this method cannot provide unauthorized access in any way.\r\n    function __RegistryBase_init() internal onlyInitializing {\r\n        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);\r\n    }\r\n\r\n    // PUBLIC FUNCTIONS\r\n    /// @dev This method is executed during deployment and upgrade of the contract to link the main protocol contract with the Registry data storage by storing the address of the Service contract.\r\n    function setService(\r\n        address service_\r\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\r\n        service = service_;\r\n    }\r\n}\r\n"
      },
      "contracts/registry/TokensRegistry.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.17;\n\nimport \"./RegistryBase.sol\";\nimport \"../libraries/ExceptionsLibrary.sol\";\nimport \"../interfaces/registry/ITokensRegistry.sol\";\n\nabstract contract TokensRegistry is RegistryBase, ITokensRegistry {\n    // CONSTANTS\n\n    /// @dev Whitelisted token role\n    bytes32 public constant WHITELISTED_TOKEN_ROLE =\n        keccak256(\"WHITELISTED_TOKEN\");\n\n    // PUBLIC FUNCTIONS\n\n    function whitelistTokens(\n        address[] calldata tokens\n    ) external onlyRole(DEFAULT_ADMIN_ROLE) {\n        for (uint256 i = 0; i < tokens.length; i++) {\n            _grantRole(WHITELISTED_TOKEN_ROLE, tokens[i]);\n        }\n    }\n\n    // PUBLIC VIEW FUNCTIONS\n\n    /**\n     * @dev Check if token is whitelisted\n     * @param token Token\n     * @return Is token whitelisted\n     */\n    function isTokenWhitelisted(address token) external view returns (bool) {\n        return hasRole(WHITELISTED_TOKEN_ROLE, token);\n    }\n}\n"
      },
      "contracts/utils/Logger.sol": {
        "content": "// SPDX-License-Identifier: MIT\r\n\r\npragma solidity 0.8.17;\r\n\r\nabstract contract Logger  {\r\n\r\n    event CompanyDAOLog(address sender, address receiver, uint256 value, bytes data, address service);\r\n\r\n}"
      }
    }
  }}