creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "starkware/solidity/libraries/AccessControl.sol": {
        "content": "/*\n  Copyright 2019-2023 StarkWare Industries Ltd.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\").\n  You may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  https://www.starkware.co/open-source-license/\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions\n  and limitations under the License.\n*/\n// SPDX-License-Identifier: MIT\n// Based on OpenZeppelin Contract (access/AccessControl.sol)\n// StarkWare modification (storage slot, change to library).\n\npragma solidity ^0.8.0;\n\nimport \"third_party/open_zeppelin/utils/Strings.sol\";\n\n/*\n  Library module that allows using contracts 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 \n  OpenZeppelin implementation changed as following:\n  1. Converted to library.\n  2. Storage valiable {_roles} moved outside of linear storage,\n     to avoid potential storage conflicts or corruption.\n  3. Removed ERC165 support.\n*/\nlibrary AccessControl {\n    /*\n      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(\n        bytes32 indexed role,\n        bytes32 indexed previousAdminRole,\n        bytes32 indexed newAdminRole\n    );\n\n    /*\n      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      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    struct RoleData {\n        mapping(address => bool) members;\n        bytes32 adminRole;\n    }\n\n    // Context interface functions.\n    function _msgSender() internal view returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal pure returns (bytes calldata) {\n        return msg.data;\n    }\n\n    // The storage variable `_roles` is located away from the contract linear area (low storage addresses)\n    // to prevent potential collision/corruption in upgrade scenario.\n    // Slot = Web3.keccak(text=\"AccesControl_Storage_Slot\").\n    bytes32 constant rolesSlot = 0x53e43b954ba190a7e49386f1f78b01dcd9f628db23f432fa029a7dfd6d98e8fb;\n\n    function _roles() private pure returns (mapping(bytes32 => RoleData) storage roles) {\n        assembly {\n            roles.slot := rolesSlot\n        }\n    }\n\n    bytes32 constant DEFAULT_ADMIN_ROLE = 0x00;\n\n    /*\n      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      Returns `true` if `account` has been granted `role`.\n    */\n    function hasRole(bytes32 role, address account) internal view returns (bool) {\n        return _roles()[role].members[account];\n    }\n\n    /*\n      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 {\n        _checkRole(role, _msgSender());\n    }\n\n    /*\n      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 {\n        if (!hasRole(role, account)) {\n            revert(\n                string(\n                    abi.encodePacked(\n                        \"AccessControl: account \",\n                        Strings.toHexString(uint160(account), 20),\n                        \" is missing role \",\n                        Strings.toHexString(uint256(role), 32)\n                    )\n                )\n            );\n        }\n    }\n\n    /*\n      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) internal view returns (bytes32) {\n        return _roles()[role].adminRole;\n    }\n\n    /*\n      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) internal onlyRole(getRoleAdmin(role)) {\n        _grantRole(role, account);\n    }\n\n    /*\n      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) internal onlyRole(getRoleAdmin(role)) {\n        _revokeRole(role, account);\n    }\n\n    /*\n      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) internal {\n        require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n        _revokeRole(role, account);\n    }\n\n    /*\n      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]virtual\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 {\n        _grantRole(role, account);\n    }\n\n    /*\n      Sets `adminRole` as ``role``'s admin role.\n     \n      Emits a {RoleAdminChanged} event.\n    */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal {\n        bytes32 previousAdminRole = getRoleAdmin(role);\n        _roles()[role].adminRole = adminRole;\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\n    }\n\n    /*\n      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 {\n        if (!hasRole(role, account)) {\n            _roles()[role].members[account] = true;\n            emit RoleGranted(role, account, _msgSender());\n        }\n    }\n\n    /*\n      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 {\n        if (hasRole(role, account)) {\n            _roles()[role].members[account] = false;\n            emit RoleRevoked(role, account, _msgSender());\n        }\n    }\n}\n"
      },
      "starkware/solidity/libraries/Addresses.sol": {
        "content": "/*\n  Copyright 2019-2023 StarkWare Industries Ltd.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\").\n  You may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  https://www.starkware.co/open-source-license/\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions\n  and limitations under the License.\n*/\n// SPDX-License-Identifier: Apache-2.0.\npragma solidity ^0.8.0;\n\n/*\n  Common Utility Libraries.\n  I. Addresses (extending address).\n*/\nlibrary Addresses {\n    /*\n      Note: isContract function has some known limitation.\n      See https://github.com/OpenZeppelin/\n      openzeppelin-contracts/blob/master/contracts/utils/Address.sol.\n    */\n    function isContract(address account) internal view returns (bool) {\n        uint256 size;\n        assembly {\n            size := extcodesize(account)\n        }\n        return size > 0;\n    }\n\n    function performEthTransfer(address recipient, uint256 amount) internal {\n        if (amount == 0) return;\n        (bool success, ) = recipient.call{value: amount}(\"\"); // NOLINT: low-level-calls.\n        require(success, \"ETH_TRANSFER_FAILED\");\n    }\n\n    /*\n      Safe wrapper around ERC20/ERC721 calls.\n      This is required because many deployed ERC20 contracts don't return a value.\n      See https://github.com/ethereum/solidity/issues/4116.\n    */\n    function safeTokenContractCall(address tokenAddress, bytes memory callData) internal {\n        require(isContract(tokenAddress), \"BAD_TOKEN_ADDRESS\");\n        // NOLINTNEXTLINE: low-level-calls.\n        (bool success, bytes memory returndata) = tokenAddress.call(callData);\n        require(success, string(returndata));\n\n        if (returndata.length > 0) {\n            require(abi.decode(returndata, (bool)), \"TOKEN_OPERATION_FAILED\");\n        }\n    }\n}\n"
      },
      "starkware/solidity/libraries/NamedStorage.sol": {
        "content": "/*\n  Copyright 2019-2023 StarkWare Industries Ltd.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\").\n  You may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  https://www.starkware.co/open-source-license/\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions\n  and limitations under the License.\n*/\n// SPDX-License-Identifier: Apache-2.0.\npragma solidity ^0.8.0;\n\n/*\n  Library to provide basic storage, in storage location out of the low linear address space.\n\n  New types of storage variables should be added here upon need.\n*/\nlibrary NamedStorage {\n    function bytes32ToBoolMapping(string memory tag_)\n        internal\n        pure\n        returns (mapping(bytes32 => bool) storage randomVariable)\n    {\n        bytes32 location = keccak256(abi.encodePacked(tag_));\n        assembly {\n            randomVariable.slot := location\n        }\n    }\n\n    function bytes32ToUint256Mapping(string memory tag_)\n        internal\n        pure\n        returns (mapping(bytes32 => uint256) storage randomVariable)\n    {\n        bytes32 location = keccak256(abi.encodePacked(tag_));\n        assembly {\n            randomVariable.slot := location\n        }\n    }\n\n    function addressToUint256Mapping(string memory tag_)\n        internal\n        pure\n        returns (mapping(address => uint256) storage randomVariable)\n    {\n        bytes32 location = keccak256(abi.encodePacked(tag_));\n        assembly {\n            randomVariable.slot := location\n        }\n    }\n\n    function bytes32ToAddressMapping(string memory tag_)\n        internal\n        pure\n        returns (mapping(bytes32 => address) storage randomVariable)\n    {\n        bytes32 location = keccak256(abi.encodePacked(tag_));\n        assembly {\n            randomVariable.slot := location\n        }\n    }\n\n    function uintToAddressMapping(string memory tag_)\n        internal\n        pure\n        returns (mapping(uint256 => address) storage randomVariable)\n    {\n        bytes32 location = keccak256(abi.encodePacked(tag_));\n        assembly {\n            randomVariable.slot := location\n        }\n    }\n\n    function addressToAddressMapping(string memory tag_)\n        internal\n        pure\n        returns (mapping(address => address) storage randomVariable)\n    {\n        bytes32 location = keccak256(abi.encodePacked(tag_));\n        assembly {\n            randomVariable.slot := location\n        }\n    }\n\n    function addressToAddressListMapping(string memory tag_)\n        internal\n        pure\n        returns (mapping(address => address[]) storage randomVariable)\n    {\n        bytes32 location = keccak256(abi.encodePacked(tag_));\n        assembly {\n            randomVariable.slot := location\n        }\n    }\n\n    function addressToBoolMapping(string memory tag_)\n        internal\n        pure\n        returns (mapping(address => bool) storage randomVariable)\n    {\n        bytes32 location = keccak256(abi.encodePacked(tag_));\n        assembly {\n            randomVariable.slot := location\n        }\n    }\n\n    function getUintValue(string memory tag_) internal view returns (uint256 retVal) {\n        bytes32 slot = keccak256(abi.encodePacked(tag_));\n        assembly {\n            retVal := sload(slot)\n        }\n    }\n\n    function setUintValue(string memory tag_, uint256 value) internal {\n        bytes32 slot = keccak256(abi.encodePacked(tag_));\n        assembly {\n            sstore(slot, value)\n        }\n    }\n\n    function setUintValueOnce(string memory tag_, uint256 value) internal {\n        require(getUintValue(tag_) == 0, \"ALREADY_SET\");\n        setUintValue(tag_, value);\n    }\n\n    function getAddressValue(string memory tag_) internal view returns (address retVal) {\n        bytes32 slot = keccak256(abi.encodePacked(tag_));\n        assembly {\n            retVal := sload(slot)\n        }\n    }\n\n    function setAddressValue(string memory tag_, address value) internal {\n        bytes32 slot = keccak256(abi.encodePacked(tag_));\n        assembly {\n            sstore(slot, value)\n        }\n    }\n\n    function setAddressValueOnce(string memory tag_, address value) internal {\n        require(getAddressValue(tag_) == address(0x0), \"ALREADY_SET\");\n        setAddressValue(tag_, value);\n    }\n\n    function getBoolValue(string memory tag_) internal view returns (bool retVal) {\n        bytes32 slot = keccak256(abi.encodePacked(tag_));\n        assembly {\n            retVal := sload(slot)\n        }\n    }\n\n    function setBoolValue(string memory tag_, bool value) internal {\n        bytes32 slot = keccak256(abi.encodePacked(tag_));\n        assembly {\n            sstore(slot, value)\n        }\n    }\n}\n"
      },
      "starkware/solidity/upgrade/Proxy.sol": {
        "content": "/*\n  Copyright 2019-2023 StarkWare Industries Ltd.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\").\n  You may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  https://www.starkware.co/open-source-license/\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions\n  and limitations under the License.\n*/\n// SPDX-License-Identifier: Apache-2.0.\npragma solidity ^0.8.16; //CAHNGED pragma solidity ^0.8.20\n\nimport \"starkware/solidity/upgrade/ProxyStorage.sol\";\nimport \"starkware/solidity/upgrade/StorageSlots.sol\";\nimport \"starkware/solidity/components/Roles.sol\";\nimport \"starkware/solidity/libraries/Addresses.sol\";\n\n/**\n  The Proxy contract implements delegation of calls to other contracts (`implementations`), with\n  proper forwarding of return values and revert reasons. This pattern allows retaining the contract\n  storage while replacing implementation code.\n\n  The following operations are supported by the proxy contract:\n\n  - :sol:func:`addImplementation`: Defines a new implementation, the data with which it should be initialized and whether this will be the last version of implementation.\n  - :sol:func:`upgradeTo`: Once an implementation is added, the governor may upgrade to that implementation only after a safety time period has passed (time lock), the current implementation is not the last version and the implementation is not frozen (see :sol:mod:`FullWithdrawals`).\n  - :sol:func:`removeImplementation`: Any announced implementation may be removed. Removing an implementation is especially important once it has been used for an upgrade in order to avoid an additional unwanted revert to an older version.\n\n  The only entity allowed to perform the above operations is the proxy governor\n  (see :sol:mod:`ProxyGovernance`).\n\n  Every implementation is required to have an `initialize` function that replaces the constructor\n  of a normal contract. Furthermore, the only parameter of this function is an array of bytes\n  (`data`) which may be decoded arbitrarily by the `initialize` function. It is up to the\n  implementation to ensure that this function cannot be run more than once if so desired.\n\n  When an implementation is added (:sol:func:`addImplementation`) the initialization `data` is also\n  announced, allowing users of the contract to analyze the full effect of an upgrade to the new\n  implementation. During an :sol:func:`upgradeTo`, the `data` is provided again and only if it is\n  identical to the announced `data` is the upgrade performed by pointing the proxy to the new\n  implementation and calling its `initialize` function with this `data`.\n\n  ProxyStorage contains the storage variables required by the Proxy.\n  The Proxy storage variables are not in the low slot addresses (a.k.a linear storage) - to avoid\n  storage collision.\n*/\ncontract Proxy is ProxyStorage, StorageSlots, Roles {\n    // Emitted when the active implementation is replaced.\n    event ImplementationUpgraded(address indexed implementation, bytes initializer);\n\n    // Emitted when an implementation is submitted as an upgrade candidate and a time lock\n    // is activated.\n    event ImplementationAdded(address indexed implementation, bytes initializer, bool finalize);\n\n    // Emitted when an implementation is removed from the list of upgrade candidates.\n    event ImplementationRemoved(address indexed implementation, bytes initializer, bool finalize);\n\n    // Emitted when the implementation is finalized.\n    event FinalizedImplementation(address indexed implementation);\n\n    using Addresses for address;\n\n    uint256 public constant MAX_UPGRADE_DELAY = 180 days;\n\n    string public constant PROXY_VERSION = \"5.0.0\";\n\n    // Initialize Roles(false) so that we cannot renounce governance.\n    constructor(uint256 upgradeActivationDelay) Roles(false) {\n        setUpgradeActivationDelay(upgradeActivationDelay);\n        setEnableWindowDuration(14 days);\n    }\n\n    /*\n      Stores the upgrade activation delay (in seconds) in the appropriate slot.\n      this function does not validate the delay value, as it's checked in the getter.\n    */\n    function setUpgradeActivationDelay(uint256 delayInSeconds) private {\n        bytes32 slot = UPGRADE_DELAY_SLOT;\n        assembly {\n            sstore(slot, delayInSeconds)\n        }\n    }\n\n    /*\n      Reads the upgrade activation delay (in seconds) at the appropriate slot.\n      The returned value is capped at MAX_UPGRADE_DELAY.\n      It is safer to do the capping in the getter because an upgrade\n      flow might modify this value without going through the setter function.\n    */\n    function getUpgradeActivationDelay() public view returns (uint256 delay) {\n        bytes32 slot = UPGRADE_DELAY_SLOT;\n        assembly {\n            delay := sload(slot)\n        }\n\n        delay = (delay < MAX_UPGRADE_DELAY) ? delay : MAX_UPGRADE_DELAY;\n        return delay;\n    }\n\n    function getEnableWindowDuration() public view returns (uint256 duration) {\n        bytes32 slot = ENABLE_WINDOW_DURATION_SLOT;\n        assembly {\n            duration := sload(slot)\n        }\n    }\n\n    function setEnableWindowDuration(uint256 durationInSeconds) private {\n        bytes32 slot = ENABLE_WINDOW_DURATION_SLOT;\n        assembly {\n            sstore(slot, durationInSeconds)\n        }\n    }\n\n    /*\n      Returns the address of the current implementation.\n    */\n    // NOLINTNEXTLINE external-function.\n    function implementation() public view returns (address _implementation) {\n        bytes32 slot = IMPLEMENTATION_SLOT;\n        assembly {\n            _implementation := sload(slot)\n        }\n    }\n\n    /*\n      Returns true if the implementation is frozen.\n      If the implementation was not assigned yet, returns false.\n    */\n    function implementationIsFrozen() private returns (bool) {\n        address _implementation = implementation();\n\n        // We can't call low level implementation before it's assigned. (i.e. ZERO).\n        if (_implementation == address(0x0)) {\n            return false;\n        }\n\n        // NOLINTNEXTLINE: low-level-calls.\n        (bool success, bytes memory returndata) = _implementation.delegatecall(\n            abi.encodeWithSignature(\"isFrozen()\")\n        );\n        require(success, string(returndata));\n        return abi.decode(returndata, (bool));\n    }\n\n    /*\n      This method blocks delegation to initialize().\n      Only upgradeTo should be able to delegate call to initialize().\n    */\n    function initialize(\n        bytes calldata /*data*/\n    ) external pure {\n        revert(\"CANNOT_CALL_INITIALIZE\");\n    }\n\n    modifier notFinalized() {\n        require(isNotFinalized(), \"IMPLEMENTATION_FINALIZED\");\n        _;\n    }\n\n    /*\n      Forbids calling the function if the implementation is frozen.\n      This modifier relies on the lower level (logical contract) implementation of isFrozen().\n    */\n    modifier notFrozen() {\n        require(!implementationIsFrozen(), \"STATE_IS_FROZEN\");\n        _;\n    }\n\n    /*\n      This entry point serves only transactions with empty calldata. (i.e. pure value transfer tx).\n      We don't expect to receive such, thus block them.\n    */\n    receive() external payable {\n        revert(\"CONTRACT_NOT_EXPECTED_TO_RECEIVE\");\n    }\n\n    /*\n      Contract's default function. Delegates execution to the implementation contract.\n      It returns back to the external caller whatever the implementation delegated code returns.\n    */\n    fallback() external payable {\n        address _implementation = implementation();\n        require(_implementation != address(0x0), \"MISSING_IMPLEMENTATION\");\n\n        assembly {\n            // Copy msg.data. We take full control of memory in this inline assembly\n            // block because it will not return to Solidity code. We overwrite the\n            // Solidity scratch pad at memory position 0.\n            calldatacopy(0, 0, calldatasize())\n\n            // Call the implementation.\n            // out and outsize are 0 for now, as we don't know the out size yet.\n            let result := delegatecall(gas(), _implementation, 0, calldatasize(), 0, 0)\n\n            // Copy the returned data.\n            returndatacopy(0, 0, returndatasize())\n\n            // TODO(Remo): Find a way to properly propagae inner OOG error.\n            switch result\n            // delegatecall returns 0 on error.\n            case 0 {\n                revert(0, returndatasize())\n            }\n            default {\n                return(0, returndatasize())\n            }\n        }\n    }\n\n    /*\n      Sets the implementation address of the proxy.\n    */\n    function setImplementation(address newImplementation) private {\n        bytes32 slot = IMPLEMENTATION_SLOT;\n        assembly {\n            sstore(slot, newImplementation)\n        }\n    }\n\n    /*\n      Returns true if the contract is not in the finalized state.\n    */\n    function isNotFinalized() public view returns (bool notFinal) {\n        bytes32 slot = FINALIZED_STATE_SLOT;\n        uint256 slotValue;\n        assembly {\n            slotValue := sload(slot)\n        }\n        notFinal = (slotValue == 0);\n    }\n\n    /*\n      Marks the current implementation as finalized.\n    */\n    function setFinalizedFlag() private {\n        bytes32 slot = FINALIZED_STATE_SLOT;\n        assembly {\n            sstore(slot, 0x1)\n        }\n    }\n\n    /*\n      Introduce an implementation and its initialization vector,\n      and start the time-lock before it can be upgraded to.\n      addImplementation is not blocked when frozen or finalized.\n      (upgradeTo API is blocked when finalized or frozen).\n    */\n    function addImplementation(\n        address newImplementation,\n        bytes calldata data,\n        bool finalize\n    ) external onlyUpgradeGovernor {\n        require(newImplementation.isContract(), \"ADDRESS_NOT_CONTRACT\");\n\n        bytes32 implVectorHash = keccak256(abi.encode(newImplementation, data, finalize));\n\n        uint256 activationTime = block.timestamp + getUpgradeActivationDelay();\n        uint256 lastActivationTime = activationTime + getEnableWindowDuration();\n\n        enabledTime()[implVectorHash] = activationTime;\n        expirationTime()[implVectorHash] = lastActivationTime;\n        emit ImplementationAdded(newImplementation, data, finalize);\n    }\n\n    /*\n      Removes a candidate implementation.\n      Note that it is possible to remove the current implementation. Doing so doesn't affect the\n      current implementation, but rather revokes it as a future candidate.\n    */\n    function removeImplementation(\n        address removedImplementation,\n        bytes calldata data,\n        bool finalize\n    ) external onlyUpgradeGovernor {\n        bytes32 implVectorHash = keccak256(abi.encode(removedImplementation, data, finalize));\n\n        // If we have initializer, we set the hash of it.\n        uint256 activationTime = enabledTime()[implVectorHash];\n        require(activationTime > 0, \"UNKNOWN_UPGRADE_INFORMATION\");\n        delete enabledTime()[implVectorHash];\n        delete expirationTime()[implVectorHash];\n        emit ImplementationRemoved(removedImplementation, data, finalize);\n    }\n\n    /*\n      Upgrades the proxy to a new implementation, with its initialization.\n      to upgrade successfully, implementation must have been added time-lock agreeably\n      before, and the init vector must be identical ot the one submitted before.\n\n      Upon assignment of new implementation address,\n      its initialize will be called with the initializing vector (even if empty).\n      Therefore, the implementation MUST must have such a method.\n\n      Note - Initialization data is committed to in advance, therefore it must remain valid\n      until the actual contract upgrade takes place.\n\n      Care should be taken regarding initialization data and flow when planning the contract upgrade.\n\n      When planning contract upgrade, special care is also needed with regard to governance\n      (See comments in Governance.sol).\n    */\n    // NOLINTNEXTLINE: reentrancy-events timestamp.\n    function upgradeTo(\n        address newImplementation,\n        bytes calldata data,\n        bool finalize\n    ) external payable onlyUpgradeGovernor notFinalized notFrozen {\n        bytes32 implVectorHash = keccak256(abi.encode(newImplementation, data, finalize));\n        uint256 activationTime = enabledTime()[implVectorHash];\n        uint256 lastActivationTime = expirationTime()[implVectorHash];\n        require(activationTime > 0, \"UNKNOWN_UPGRADE_INFORMATION\");\n        require(newImplementation.isContract(), \"ADDRESS_NOT_CONTRACT\");\n\n        // On the first time an implementation is set - time-lock should not be enforced.\n        require(\n            activationTime <= block.timestamp || implementation() == address(0x0),\n            \"UPGRADE_NOT_ENABLED_YET\"\n        );\n        require(lastActivationTime >= block.timestamp, \"IMPLEMENTATION_EXPIRED\");\n\n        setImplementation(newImplementation);\n\n        // NOLINTNEXTLINE: low-level-calls controlled-delegatecall.\n        (bool success, bytes memory returndata) = newImplementation.delegatecall(\n            abi.encodeWithSelector(this.initialize.selector, data)\n        );\n        require(success, string(returndata));\n\n        // Verify that the new implementation is not frozen post initialization.\n        // NOLINTNEXTLINE: low-level-calls controlled-delegatecall.\n        (success, returndata) = newImplementation.delegatecall(\n            abi.encodeWithSignature(\"isFrozen()\")\n        );\n        require(success, \"CALL_TO_ISFROZEN_REVERTED\");\n        require(!abi.decode(returndata, (bool)), \"NEW_IMPLEMENTATION_FROZEN\");\n\n        // Remove implementation activation entries.\n        delete enabledTime()[implVectorHash];\n        delete expirationTime()[implVectorHash];\n\n        emit ImplementationUpgraded(newImplementation, data);\n\n        if (finalize) {\n            setFinalizedFlag();\n            emit FinalizedImplementation(newImplementation);\n        }\n    }\n}\n"
      },
      "starkware/solidity/upgrade/ProxyStorage.sol": {
        "content": "/*\n  Copyright 2019-2023 StarkWare Industries Ltd.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\").\n  You may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  https://www.starkware.co/open-source-license/\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions\n  and limitations under the License.\n*/\n// SPDX-License-Identifier: Apache-2.0.\npragma solidity ^0.8.0;\n\nimport \"starkware/solidity/libraries/NamedStorage.sol\";\n\n/*\n  Holds the Proxy-specific state variables.\n  to prevent collision hazard.\n*/\ncontract ProxyStorage {\n    // Random storage slot tags.\n    string constant ENABLED_TIME_TAG = \"PROXY_5_ENABLED_TIME\";\n    string constant DISABLED_TIME_TAG = \"PROXY_5_DISABLED_TIME\";\n    string constant INTIALIZED_TAG = \"PROXY_5_INITIALIZED\";\n\n    // The time after which we can switch to the implementation.\n    // Hash(implementation, data, finalize) => time.\n    function enabledTime() internal pure returns (mapping(bytes32 => uint256) storage) {\n        return NamedStorage.bytes32ToUint256Mapping(ENABLED_TIME_TAG);\n    }\n\n    // The time after which we can NO LONGER switch to the implementation.\n    // Implementation is valid to switch in time t,  enableTime <= t  <= disableTime.\n    // Hash(implementation, data, finalize) => time.\n    function expirationTime() internal pure returns (mapping(bytes32 => uint256) storage) {\n        return NamedStorage.bytes32ToUint256Mapping(DISABLED_TIME_TAG);\n    }\n\n    // A central storage of the flags whether implementation has been initialized.\n    // Note - it can be used flexibly enough to accommodate multiple levels of initialization\n    // (i.e. using different key salting schemes for different initialization levels).\n    function initialized() internal pure returns (mapping(bytes32 => bool) storage) {\n        return NamedStorage.bytes32ToBoolMapping(INTIALIZED_TAG);\n    }\n}\n"
      },
      "starkware/solidity/components/Roles.sol": {
        "content": "/*\n  Copyright 2019-2023 StarkWare Industries Ltd.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\").\n  You may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  https://www.starkware.co/open-source-license/\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions\n  and limitations under the License.\n*/\n// SPDX-License-Identifier: Apache-2.0.\npragma solidity ^0.8.0;\n\nimport \"starkware/solidity/libraries/RolesLib.sol\";\n\nabstract contract Roles {\n    // This flag dermine if the GOVERNANCE_ADMIN role can be renounced.\n    bool immutable fullyRenouncable;\n\n    constructor(bool renounceable) {\n        fullyRenouncable = renounceable;\n        RolesLib.initialize();\n    }\n\n    // MODIFIERS.\n    modifier onlyAppGovernor() {\n        require(isAppGovernor(AccessControl._msgSender()), \"ONLY_APP_GOVERNOR\");\n        _;\n    }\n\n    modifier onlyOperator() {\n        require(isOperator(AccessControl._msgSender()), \"ONLY_OPERATOR\");\n        _;\n    }\n\n    modifier onlySecurityAdmin() {\n        require(isSecurityAdmin(AccessControl._msgSender()), \"ONLY_SECURITY_ADMIN\");\n        _;\n    }\n\n    modifier onlySecurityAgent() {\n        require(isSecurityAgent(AccessControl._msgSender()), \"ONLY_SECURITY_AGENT\");\n        _;\n    }\n\n    modifier onlyTokenAdmin() {\n        require(isTokenAdmin(AccessControl._msgSender()), \"ONLY_TOKEN_ADMIN\");\n        _;\n    }\n\n    modifier onlyUpgradeGovernor() {\n        require(isUpgradeGovernor(AccessControl._msgSender()), \"ONLY_UPGRADE_GOVERNOR\");\n        _;\n    }\n\n    modifier notSelf(address account) {\n        require(account != AccessControl._msgSender(), \"CANNOT_PERFORM_ON_SELF\");\n        _;\n    }\n\n    // Is holding role.\n    function isAppGovernor(address account) public view returns (bool) {\n        return AccessControl.hasRole(APP_GOVERNOR, account);\n    }\n\n    function isAppRoleAdmin(address account) public view returns (bool) {\n        return AccessControl.hasRole(APP_ROLE_ADMIN, account);\n    }\n\n    function isGovernanceAdmin(address account) public view returns (bool) {\n        return AccessControl.hasRole(GOVERNANCE_ADMIN, account);\n    }\n\n    function isOperator(address account) public view returns (bool) {\n        return AccessControl.hasRole(OPERATOR, account);\n    }\n\n    function isSecurityAdmin(address account) public view returns (bool) {\n        return AccessControl.hasRole(SECURITY_ADMIN, account);\n    }\n\n    function isSecurityAgent(address account) public view returns (bool) {\n        return AccessControl.hasRole(SECURITY_AGENT, account);\n    }\n\n    function isTokenAdmin(address account) public view returns (bool) {\n        return AccessControl.hasRole(TOKEN_ADMIN, account);\n    }\n\n    function isUpgradeGovernor(address account) public view returns (bool) {\n        return AccessControl.hasRole(UPGRADE_GOVERNOR, account);\n    }\n\n    // Register Role.\n    function registerAppGovernor(address account) external {\n        AccessControl.grantRole(APP_GOVERNOR, account);\n    }\n\n    function registerAppRoleAdmin(address account) external {\n        AccessControl.grantRole(APP_ROLE_ADMIN, account);\n    }\n\n    function registerGovernanceAdmin(address account) external {\n        AccessControl.grantRole(GOVERNANCE_ADMIN, account);\n    }\n\n    function registerOperator(address account) external {\n        AccessControl.grantRole(OPERATOR, account);\n    }\n\n    function registerSecurityAdmin(address account) external {\n        AccessControl.grantRole(SECURITY_ADMIN, account);\n    }\n\n    function registerSecurityAgent(address account) external {\n        AccessControl.grantRole(SECURITY_AGENT, account);\n    }\n\n    function registerTokenAdmin(address account) external {\n        AccessControl.grantRole(TOKEN_ADMIN, account);\n    }\n\n    function registerUpgradeGovernor(address account) external {\n        AccessControl.grantRole(UPGRADE_GOVERNOR, account);\n    }\n\n    // Revoke Role.\n    function revokeAppGovernor(address account) external {\n        AccessControl.revokeRole(APP_GOVERNOR, account);\n    }\n\n    function revokeAppRoleAdmin(address account) external notSelf(account) {\n        AccessControl.revokeRole(APP_ROLE_ADMIN, account);\n    }\n\n    function revokeGovernanceAdmin(address account) external notSelf(account) {\n        AccessControl.revokeRole(GOVERNANCE_ADMIN, account);\n    }\n\n    function revokeOperator(address account) external {\n        AccessControl.revokeRole(OPERATOR, account);\n    }\n\n    function revokeSecurityAdmin(address account) external notSelf(account) {\n        AccessControl.revokeRole(SECURITY_ADMIN, account);\n    }\n\n    function revokeSecurityAgent(address account) external {\n        AccessControl.revokeRole(SECURITY_AGENT, account);\n    }\n\n    function revokeTokenAdmin(address account) external {\n        AccessControl.revokeRole(TOKEN_ADMIN, account);\n    }\n\n    function revokeUpgradeGovernor(address account) external {\n        AccessControl.revokeRole(UPGRADE_GOVERNOR, account);\n    }\n\n    // Renounce Role.\n    function renounceRole(bytes32 role, address account) external {\n        if (role == GOVERNANCE_ADMIN && !fullyRenouncable) {\n            revert(\"CANNOT_RENOUNCE_GOVERNANCE_ADMIN\");\n        }\n        AccessControl.renounceRole(role, account);\n    }\n}\n"
      },
      "starkware/solidity/libraries/RolesLib.sol": {
        "content": "/*\n  Copyright 2019-2023 StarkWare Industries Ltd.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\").\n  You may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  https://www.starkware.co/open-source-license/\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions\n  and limitations under the License.\n*/\n// SPDX-License-Identifier: Apache-2.0.\npragma solidity ^0.8.0;\n\nimport \"starkware/solidity/libraries/AccessControl.sol\";\n\n// int.from_bytes(Web3.keccak(text=\"ROLE_APP_GOVERNOR\"), \"big\") & MASK_250 .\nbytes32 constant APP_GOVERNOR = bytes32(\n    uint256(0xd2ead78c620e94b02d0a996e99298c59ddccfa1d8a0149080ac3a20de06068)\n);\n\n// int.from_bytes(Web3.keccak(text=\"ROLE_APP_ROLE_ADMIN\"), \"big\") & MASK_250 .\nbytes32 constant APP_ROLE_ADMIN = bytes32(\n    uint256(0x03e615638e0b79444a70f8c695bf8f2a47033bf1cf95691ec3130f64939cee99)\n);\n\n// int.from_bytes(Web3.keccak(text=\"ROLE_GOVERNANCE_ADMIN\"), \"big\") & MASK_250 .\nbytes32 constant GOVERNANCE_ADMIN = bytes32(\n    uint256(0x03711c9d994faf6055172091cb841fd4831aa743e6f3315163b06a122c841846)\n);\n\n// int.from_bytes(Web3.keccak(text=\"ROLE_OPERATOR\"), \"big\") & MASK_250 .\nbytes32 constant OPERATOR = bytes32(\n    uint256(0x023edb77f7c8cc9e38e8afe78954f703aeeda7fffe014eeb6e56ea84e62f6da7)\n);\n\n// int.from_bytes(Web3.keccak(text=\"ROLE_SECURITY_ADMIN\"), \"big\") & MASK_250 .\nbytes32 constant SECURITY_ADMIN = bytes32(\n    uint256(0x026bd110619d11cfdfc28e281df893bc24828e89177318e9dbd860cdaedeb6b3)\n);\n\n// int.from_bytes(Web3.keccak(text=\"ROLE_SECURITY_AGENT\"), \"big\") & MASK_250 .\nbytes32 constant SECURITY_AGENT = bytes32(\n    uint256(0x037693ba312785932d430dccf0f56ffedd0aa7c0f8b6da2cc4530c2717689b96)\n);\n\n// int.from_bytes(Web3.keccak(text=\"ROLE_TOKEN_ADMIN\"), \"big\") & MASK_250 .\nbytes32 constant TOKEN_ADMIN = bytes32(\n    uint256(0x0128d63adbf6b09002c26caf55c47e2f26635807e3ef1b027218aa74c8d61a3e)\n);\n\n// int.from_bytes(Web3.keccak(text=\"ROLE_UPGRADE_GOVERNOR\"), \"big\") & MASK_250 .\nbytes32 constant UPGRADE_GOVERNOR = bytes32(\n    uint256(0x0251e864ca2a080f55bce5da2452e8cfcafdbc951a3e7fff5023d558452ec228)\n);\n\n/*\n  Role                |   Role Admin\n  ----------------------------------------\n  GOVERNANCE_ADMIN    |   GOVERNANCE_ADMIN\n  UPGRADE_GOVERNOR    |   GOVERNANCE_ADMIN\n  APP_ROLE_ADMIN      |   GOVERNANCE_ADMIN\n  APP_GOVERNOR        |   APP_ROLE_ADMIN\n  OPERATOR            |   APP_ROLE_ADMIN\n  TOKEN_ADMIN         |   APP_ROLE_ADMIN\n  SECURITY_ADMIN      |   SECURITY_ADMIN\n  SECURITY_AGENT      |   SECURITY_ADMIN .\n*/\nlibrary RolesLib {\n    // INITIALIZERS.\n    function governanceRolesInitialized() internal view returns (bool) {\n        return AccessControl.getRoleAdmin(GOVERNANCE_ADMIN) != bytes32(0x00);\n    }\n\n    function securityRolesInitialized() internal view returns (bool) {\n        return AccessControl.getRoleAdmin(SECURITY_ADMIN) != bytes32(0x00);\n    }\n\n    function initialize() internal {\n        address provisional = AccessControl._msgSender();\n        initialize(provisional, provisional);\n    }\n\n    function initialize(address provisionalGovernor, address provisionalSecAdmin) internal {\n        if (governanceRolesInitialized()) {\n            // Support Proxied contract initialization.\n            // In case the Proxy already initialized the roles,\n            // init will succeed IFF the provisionalGovernor is already `GovernanceAdmin`.\n            require(\n                AccessControl.hasRole(GOVERNANCE_ADMIN, provisionalGovernor),\n                \"ROLES_ALREADY_INITIALIZED\"\n            );\n        } else {\n            initGovernanceRoles(provisionalGovernor);\n        }\n\n        if (securityRolesInitialized()) {\n            // If SecurityAdmin initialized,\n            // then provisionalSecAdmin must already be a `SecurityAdmin`.\n            // If it's not initilized - initialize it.\n            require(\n                AccessControl.hasRole(SECURITY_ADMIN, provisionalSecAdmin),\n                \"SECURITY_ROLES_ALREADY_INITIALIZED\"\n            );\n        } else {\n            initSecurityRoles(provisionalSecAdmin);\n        }\n    }\n\n    function initSecurityRoles(address provisionalSecAdmin) private {\n        AccessControl._setRoleAdmin(SECURITY_ADMIN, SECURITY_ADMIN);\n        AccessControl._setRoleAdmin(SECURITY_AGENT, SECURITY_ADMIN);\n        AccessControl._grantRole(SECURITY_ADMIN, provisionalSecAdmin);\n    }\n\n    function initGovernanceRoles(address provisionalGovernor) private {\n        AccessControl._grantRole(GOVERNANCE_ADMIN, provisionalGovernor);\n        AccessControl._setRoleAdmin(APP_GOVERNOR, APP_ROLE_ADMIN);\n        AccessControl._setRoleAdmin(APP_ROLE_ADMIN, GOVERNANCE_ADMIN);\n        AccessControl._setRoleAdmin(GOVERNANCE_ADMIN, GOVERNANCE_ADMIN);\n        AccessControl._setRoleAdmin(OPERATOR, APP_ROLE_ADMIN);\n        AccessControl._setRoleAdmin(TOKEN_ADMIN, APP_ROLE_ADMIN);\n        AccessControl._setRoleAdmin(UPGRADE_GOVERNOR, GOVERNANCE_ADMIN);\n    }\n}\n"
      },
      "starkware/solidity/upgrade/StorageSlots.sol": {
        "content": "/*\n  Copyright 2019-2023 StarkWare Industries Ltd.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\").\n  You may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  https://www.starkware.co/open-source-license/\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions\n  and limitations under the License.\n*/\n// SPDX-License-Identifier: Apache-2.0.\npragma solidity ^0.8.0;\n\n/**\n  StorageSlots holds the arbitrary storage slots used throughout the Proxy pattern.\n  Storage address slots are a mechanism to define an arbitrary location, that will not be\n  overlapped by the logical contracts.\n*/\ncontract StorageSlots {\n    // Storage slot with the address of the current implementation.\n    // We need to keep this variable stored outside of the commonly used space,\n    // so that it's not overrun by the logical implementation (the proxied contract).\n    // Web3.keccak(text=\"StarkWare2019.implemntation-slot\").\n    bytes32 internal constant IMPLEMENTATION_SLOT =\n        0x177667240aeeea7e35eabe3a35e18306f336219e1386f7710a6bf8783f761b24;\n\n    // Storage slot with the address of the call-proxy current implementation.\n    // We need to keep this variable stored outside of the commonly used space.\n    // so that it's not overrun by the logical implementation (the proxied contract).\n    // Web3.keccak(text=\"StarkWare2020.CallProxy.Implemntation.Slot\").\n    bytes32 internal constant CALL_PROXY_IMPL_SLOT =\n        0x7184681641399eb4ad2fdb92114857ee6ff239f94ad635a1779978947b8843be;\n\n    // This storage slot stores the finalization flag.\n    // Once the value stored in this slot is set to non-zero\n    // the proxy blocks implementation upgrades.\n    // The current implementation is then referred to as Finalized.\n    // Web3.keccak(text=\"StarkWare2019.finalization-flag-slot\").\n    bytes32 internal constant FINALIZED_STATE_SLOT =\n        0x7d433c6f837e8f93009937c466c82efbb5ba621fae36886d0cac433c5d0aa7d2;\n\n    // Storage slot to hold the upgrade delay (time-lock).\n    // The intention of this slot is to allow modification using an EIC.\n    // Web3.keccak(text=\"StarkWare.Upgradibility.Delay.Slot\").\n    bytes32 public constant UPGRADE_DELAY_SLOT =\n        0xc21dbb3089fcb2c4f4c6a67854ab4db2b0f233ea4b21b21f912d52d18fc5db1f;\n\n    // Storage slot to hold the upgrade eanbled duration in seconds.\n    // The intention of this slot is to allow modification using an EIC.\n    // Web3.keccak(text=\"StarkWare.Upgradibility.EnableWindowDuration.Slot\").\n    bytes32 public constant ENABLE_WINDOW_DURATION_SLOT =\n        0xb00a6109e73dbe7bbf8d3f18fb9221d2d024dc2671e3d5ff02532ccc40590738;\n}\n"
      },
      "third_party/open_zeppelin/utils/Strings.sol": {
        "content": "/*\n  Copyright 2019-2023 StarkWare Industries Ltd.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\").\n  You may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  https://www.starkware.co/open-source-license/\n\n  Unless required by applicable law or agreed to in writing,\n  software distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions\n  and limitations under the License.\n*/\n// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant _HEX_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        // Inspired by OraclizeAPI's implementation - MIT licence\n        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n        if (value == 0) {\n            return \"0\";\n        }\n        uint256 temp = value;\n        uint256 digits;\n        while (temp != 0) {\n            digits++;\n            temp /= 10;\n        }\n        bytes memory buffer = new bytes(digits);\n        while (value != 0) {\n            digits -= 1;\n            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n            value /= 10;\n        }\n        return string(buffer);\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        if (value == 0) {\n            return \"0x00\";\n        }\n        uint256 temp = value;\n        uint256 length = 0;\n        while (temp != 0) {\n            length++;\n            temp >>= 8;\n        }\n        return toHexString(value, length);\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] = _HEX_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"
      }
    },
    "settings": {
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {},
      "remappings": [],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    }
  }}