ETH Price: $2,545.56 (+0.71%)

Transaction Decoder

Block:
15914789 at Nov-07-2022 01:13:59 AM +UTC
Transaction Fee:
0.001860949108992778 ETH $4.74
Gas Used:
108,919 Gas / 17.085624262 Gwei

Emitted Events:

65 Proxy.0x9dbb0e7dda3e09710ce75b801addc87cf9d9c6c581641b3275fca409ad086c62( 0x9dbb0e7dda3e09710ce75b801addc87cf9d9c6c581641b3275fca409ad086c62, 0x000000000000000000000000be11869b087ff6102af9986a524903901497d1a8, 0x006a96b6b07cdd319787f6a32c28b03c24a38a3bc890769fd51ed76495df1e2b, 0000000000000000000000000000000000000000000000000062c3f3e4c18000 )
66 Proxy.0xdb80dd488acf86d17c747445b0eabb5d57c541d3bd7b6b87af987858e5066b2b( 0xdb80dd488acf86d17c747445b0eabb5d57c541d3bd7b6b87af987858e5066b2b, 0x000000000000000000000000ae0ee0a63a2ce6baeeffe56e7714fb4efe48d419, 0x073314940630fd6dcda0d772d4c972c4e0a9946bef9dabf4ef84eda8ef542b82, 0x02d757788a8d8d6f21d1cd40bce38a8222d70654214e96ff95d8086e684fbee5, 0000000000000000000000000000000000000000000000000000000000000060, 0000000000000000000000000000000000000000000000000000000000011606, 0000000000000000000000000000000000000000000000000000000000000000, 0000000000000000000000000000000000000000000000000000000000000003, 006a96b6b07cdd319787f6a32c28b03c24a38a3bc890769fd51ed76495df1e2b, 0000000000000000000000000000000000000000000000000062c3f3e4c18000, 0000000000000000000000000000000000000000000000000000000000000000 )

Account State Difference:

  Address   Before After State Difference Code
(builder0x69)
4.808774613783833981 Eth4.809046911283833981 Eth0.0002722975
0xae0Ee0A6...EFE48D419
(Starknet: StarkGate ETH Bridge)
1,633.225475805689024492 Eth1,633.253275805689024492 Eth0.0278
0xBE11869B...01497D1A8
0.047903825899928762 Eth
Nonce: 24
0.018242876790935984 Eth
Nonce: 25
0.029660949108992778
0xc662c410...BeBD9C8c4
(Starknet: Core Contract)

Execution Trace

ETH 0.0278 Proxy.b6b55f25( )
  • ETH 0.0278 StarknetEthBridge.deposit( l2Recipient=188325976115150164464707830655491703497401607356014123922754088988537986603 )
    • Proxy.STATICCALL( )
      • Starknet.DELEGATECALL( )
      • Proxy.3e3aa6c5( )
        • Starknet.sendMessageToL2( toAddress=3256441166037631918262930812410838598500200462657642943867372734773841898370, selector=1285101517810983806491589552491143496277809242732141897358598292095611420389, payload=[188325976115150164464707830655491703497401607356014123922754088988537986603, 27800000000000000, 0] ) => ( 3BEC78821315EAEAA21E9BA5CA948D0EE2F03C5D735989DA94A7D5182A9D4CDC, 71174 )
          File 1 of 4: Proxy
          1
          {"Common.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\n\n/*\n Common Utility
              librarries.\n I. Addresses (extending address).\n*/\nlibrary Addresses {\n function isContract(address account) internal view returns (bool)
              {\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size \u003e 0;\n }\n\n
              function performEthTransfer(address recipient, uint256 amount) internal {\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\u0027t 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 \u003e 0) {\n require(abi.decode(returndata, (bool)),
              \"TOKEN_OPERATION_FAILED\");\n }\n }\n\n /*\n Validates that the passed contract address is of a real contract,\n and that
              its id hash (as infered fromn identify()) matched the expected one.\n */\n function validateContractId(address contractAddress, bytes32
              expectedIdHash) internal {\n require(isContract(contractAddress), \"ADDRESS_NOT_CONTRACT\");\n (bool success, bytes memory returndata
              ) = contractAddress.call( // NOLINT: low-level-calls.\n abi.encodeWithSignature(\"identify()\")\n );\n require(success,
              \"FAILED_TO_IDENTIFY_CONTRACT\");\n string memory realContractId = abi.decode(returndata, (string));\n require(\n
              keccak256(abi.encodePacked(realContractId)) == expectedIdHash,\n \"UNEXPECTED_CONTRACT_IDENTIFIER\"\n );\n }\n}\n\n/*\n II.
              StarkExTypes - Common data types.\n*/\nlibrary StarkExTypes {\n // Structure representing a list of verifiers (validity/availability).\n // A
              statement is valid only if all the verifiers in the list agree on it.\n // Adding a verifier to the list is immediate - this is used for fast
              resolution of\n // any soundness issues.\n // Removing from the list is time-locked, to ensure that any user of the system\n // not
              content with the announced removal has ample time to leave the system before it is\n // removed.\n struct ApprovalChainData {\n
              address[] list;\n // Represents the time after which the verifier with the given address can be removed.\n // Removal of the verifier
              with address A is allowed only in the case the value\n // of unlockedForRemovalTime[A] != 0 and unlockedForRemovalTime[A] \u003c (current
              time).\n mapping(address =\u003e uint256) unlockedForRemovalTime;\n }\n}\n"},"Governance.sol":{"content":"/*\n Copyright 2019-2022
              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.6.12;\n\nimport \"MGovernance.sol\";\n\n/*\n Implements Generic Governance, applicable
              for both proxy and main contract, and possibly others.\n Notes:\n The use of the same function names by both the Proxy and a delegated
              implementation\n is not possible since calling the implementation functions is done via the default function\n of the Proxy. For this reason,
              for example, the implementation of MainContract (MainGovernance)\n exposes mainIsGovernor, which calls the internal _isGovernor method.\n
              */\nabstract contract Governance is MGovernance {\n event LogNominatedGovernor(address nominatedGovernor);\n event LogNewGovernorAccepted
              (address acceptedGovernor);\n event LogRemovedGovernor(address removedGovernor);\n event LogNominationCancelled();\n\n function
              getGovernanceInfo() internal view virtual returns (GovernanceInfoStruct storage);\n\n /*\n Current code intentionally prevents governance
              re-initialization.\n This may be a problem in an upgrade situation, in a case that the upgrade-to implementation\n performs an
              initialization (for real) and within that calls initGovernance().\n\n Possible workarounds:\n 1. Clearing the governance info altogether
              by changing the MAIN_GOVERNANCE_INFO_TAG.\n This will remove existing main governance information.\n 2. Modify the require part in
              this function, so that it will exit quietly\n when trying to re-initialize (uncomment the lines below).\n */\n function
              initGovernance() internal {\n GovernanceInfoStruct storage gub = getGovernanceInfo();\n require(!gub.initialized,
              \"ALREADY_INITIALIZED\");\n gub.initialized = true; // to ensure addGovernor() won\u0027t fail.\n // Add the initial governer.\n
               addGovernor(msg.sender);\n }\n\n function _isGovernor(address testGovernor) internal view override returns (bool) {\n
              GovernanceInfoStruct storage gub = getGovernanceInfo();\n return gub.effectiveGovernors[testGovernor];\n }\n\n /*\n Cancels the
              nomination of a governor candidate.\n */\n function _cancelNomination() internal onlyGovernance {\n GovernanceInfoStruct storage gub =
              getGovernanceInfo();\n gub.candidateGovernor = address(0x0);\n emit LogNominationCancelled();\n }\n\n function
              _nominateNewGovernor(address newGovernor) internal onlyGovernance {\n GovernanceInfoStruct storage gub = getGovernanceInfo();\n
              require(!_isGovernor(newGovernor), \"ALREADY_GOVERNOR\");\n gub.candidateGovernor = newGovernor;\n emit LogNominatedGovernor
              (newGovernor);\n }\n\n /*\n The addGovernor is called in two cases:\n 1. by _acceptGovernance when a new governor accepts its role
              .\n 2. by initGovernance to add the initial governor.\n The difference is that the init path skips the nominate step\n that would
              fail because of the onlyGovernance modifier.\n */\n function addGovernor(address newGovernor) private {\n require(!_isGovernor
              (newGovernor), \"ALREADY_GOVERNOR\");\n GovernanceInfoStruct storage gub = getGovernanceInfo();\n gub.effectiveGovernors[newGovernor]
              = true;\n }\n\n function _acceptGovernance() internal {\n // The new governor was proposed as a candidate by the current governor.\n
               GovernanceInfoStruct storage gub = getGovernanceInfo();\n require(msg.sender == gub.candidateGovernor, \"ONLY_CANDIDATE_GOVERNOR\"
              );\n\n // Update state.\n addGovernor(gub.candidateGovernor);\n gub.candidateGovernor = address(0x0);\n\n // Send a
              notification about the change of governor.\n emit LogNewGovernorAccepted(msg.sender);\n }\n\n /*\n Remove a governor from office
              .\n */\n function _removeGovernor(address governorForRemoval) internal onlyGovernance {\n require(msg.sender != governorForRemoval,
              \"GOVERNOR_SELF_REMOVE\");\n GovernanceInfoStruct storage gub = getGovernanceInfo();\n require(_isGovernor(governorForRemoval),
              \"NOT_GOVERNOR\");\n gub.effectiveGovernors[governorForRemoval] = false;\n emit LogRemovedGovernor(governorForRemoval);\n }\n}\n"}
              ,"GovernanceStorage.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\nimport
              \"MGovernance.sol\";\n\n/*\n Holds the governance slots for ALL entities, including proxy and the main contract.\n*/\ncontract GovernanceStorage
              {\n // A map from a Governor tag to its own GovernanceInfoStruct.\n mapping(string =\u003e GovernanceInfoStruct) internal governanceInfo;
              //NOLINT uninitialized-state.\n}\n"},"MGovernance.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\n\nstruct GovernanceInfoStruct {\n mapping(address =\u003e bool) effectiveGovernors;\n address candidateGovernor
              ;\n bool initialized;\n}\n\nabstract contract MGovernance {\n function _isGovernor(address testGovernor) internal view virtual returns (bool
              );\n\n /*\n Allows calling the function only by a Governor.\n */\n modifier onlyGovernance() {\n require(_isGovernor(msg
              .sender), \"ONLY_GOVERNANCE\");\n _;\n }\n}\n"},"Proxy.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\n\nimport \"ProxyGovernance.sol\";\nimport \"ProxyStorage.sol\";\nimport \"StorageSlots.sol\";\nimport
              \"Common.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 It is the
              responsibility of the implementation not to overwrite any storage belonging to the\n proxy (`ProxyStorage`). In addition, upon upgrade, the new
              implementation is assumed to be\n backward compatible with previous implementations with respect to the storage used until that\n point.\n
              */\ncontract Proxy is ProxyStorage, ProxyGovernance, StorageSlots {\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 string public constant PROXY_VERSION = \"3.0.1\";\n\n constructor
              (uint256 upgradeActivationDelay) public {\n initGovernance();\n setUpgradeActivationDelay(upgradeActivationDelay);\n }\n\n
              function setUpgradeActivationDelay(uint256 delayInSeconds) private {\n bytes32 slot = UPGRADE_DELAY_SLOT;\n assembly {\n
              sstore(slot, delayInSeconds)\n }\n }\n\n function getUpgradeActivationDelay() public view returns (uint256 delay) {\n bytes32
              slot = UPGRADE_DELAY_SLOT;\n assembly {\n delay := sload(slot)\n }\n return delay;\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\u0027t call
              low level implementation before it\u0027s 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\u0027t expect to receive such, thus block them.\n
              */\n receive() external payable {\n revert(\"CONTRACT_NOT_EXPECTED_TO_RECEIVE\");\n }\n\n /*\n Contract\u0027s 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\u0027t 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 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 onlyGovernance {\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\n
              enabledTime[implVectorHash] = activationTime;\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\u0027t 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 onlyGovernance {\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 \u003e 0, \"UNKNOWN_UPGRADE_INFORMATION\");\n delete
              enabledTime[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
              onlyGovernance notFinalized notFrozen {\n bytes32 implVectorHash = keccak256(abi.encode(newImplementation, data, finalize));\n
              uint256 activationTime = enabledTime[implVectorHash];\n require(activationTime \u003e 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 \u003c= block.timestamp || implementation() == address(0x0),\n
              \"UPGRADE_NOT_ENABLED_YET\"\n );\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 if (finalize) {\n setFinalizedFlag();\n
              emit FinalizedImplementation(newImplementation);\n }\n\n emit ImplementationUpgraded(newImplementation, data);\n }\n}\n"}
              ,"ProxyGovernance.sol":{"content":"/*\n Copyright 2019-2022 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.6.12
              ;\n\nimport \"Governance.sol\";\nimport \"GovernanceStorage.sol\";\n\n/**\n The Proxy contract is governed by one or more Governors of which the
              initial one is the\n deployer of the contract.\n\n A governor has the sole authority to perform the following operations:\n\n 1. Nominate
              additional governors (:sol:func:`proxyNominateNewGovernor`)\n 2. Remove other governors (:sol:func:`proxyRemoveGovernor`)\n 3. Add new
              `implementations` (proxied contracts)\n 4. Remove (new or old) `implementations`\n 5. Update `implementations` after a timelock allows it\n\n
              Adding governors is performed in a two step procedure:\n\n 1. First, an existing governor nominates a new governor (:sol:func
              :`proxyNominateNewGovernor`)\n 2. Then, the new governor must accept governance to become a governor (:sol:func:`proxyAcceptGovernance`)\n\n This
              two step procedure ensures that a governor public key cannot be nominated unless there is an\n entity that has the corresponding private key. This
              is intended to prevent errors in the addition\n process.\n\n The governor private key should typically be held in a secure cold wallet or managed
              via a\n multi-sig contract.\n*/\n/*\n Implements Governance for the proxy contract.\n It is a thin wrapper to the Governance contract,\n which
              is needed so that it can have non-colliding function names,\n and a specific tag (key) to allow unique state storage.\n*/\ncontract
              ProxyGovernance is GovernanceStorage, Governance {\n // The tag is the string key that is used in the Governance storage mapping.\n string
              public constant PROXY_GOVERNANCE_TAG = \"StarkEx.Proxy.2019.GovernorsInformation\";\n\n /*\n Returns the GovernanceInfoStruct associated
              with the governance tag.\n */\n function getGovernanceInfo() internal view override returns (GovernanceInfoStruct storage) {\n return
              governanceInfo[PROXY_GOVERNANCE_TAG];\n }\n\n function proxyIsGovernor(address testGovernor) external view returns (bool) {\n return
              _isGovernor(testGovernor);\n }\n\n function proxyNominateNewGovernor(address newGovernor) external {\n _nominateNewGovernor
              (newGovernor);\n }\n\n function proxyRemoveGovernor(address governorForRemoval) external {\n _removeGovernor(governorForRemoval);\n
               }\n\n function proxyAcceptGovernance() external {\n _acceptGovernance();\n }\n\n function proxyCancelNomination() external {\n
               _cancelNomination();\n }\n}\n"},"ProxyStorage.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\n\nimport \"GovernanceStorage.sol\";\n\n/*\n Holds the Proxy-specific state variables.\n This contract is inherited
              by the GovernanceStorage (and indirectly by MainStorage)\n to prevent collision hazard.\n*/\ncontract ProxyStorage is GovernanceStorage {\n //
              NOLINTNEXTLINE: naming-convention uninitialized-state.\n mapping(address =\u003e bytes32) internal initializationHash_DEPRECATED;\n\n // The
              time after which we can switch to the implementation.\n // Hash(implementation, data, finalize) =\u003e time.\n mapping(bytes32 =\u003e
              uint256) internal enabledTime;\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 mapping(bytes32 =\u003e bool) internal initialized;\n}\n"},"StorageSlots.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\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 // The address of the slot is keccak256
              (\"StarkWare2019.implemntation-slot\").\n // We need to keep this variable stored outside of the commonly used space,\n // so that it\u0027s
              not overrun by the logical implementation (the proxied contract).\n bytes32 internal constant IMPLEMENTATION_SLOT =\n
              0x177667240aeeea7e35eabe3a35e18306f336219e1386f7710a6bf8783f761b24;\n\n // Storage slot with the address of the call-proxy current
              implementation.\n // The address of the slot is keccak256(\"\u0027StarkWare2020.CallProxy.Implemntation.Slot\u0027\").\n // We need to keep
              this variable stored outside of the commonly used space.\n // so that it\u0027s not overrun by the logical implementation (the proxied contract
              ).\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.solidityKeccak([\u0027string\u0027],
              [\"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.solidityKeccak([\u0027string\u0027], [\u0027StarkWare.Upgradibility
              .Delay.Slot\u0027]).\n bytes32 public constant UPGRADE_DELAY_SLOT =\n 0xc21dbb3089fcb2c4f4c6a67854ab4db2b0f233ea4b21b21f912d52d18fc5db1f
              ;\n}\n"}}
          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

          File 2 of 4: Proxy
          1
          {"Common.sol":{"content":"/*\n Copyright 2019-2021 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.6.12;\n\n/*\n Common Utility
              librarries.\n I. Addresses (extending address).\n*/\nlibrary Addresses {\n function isContract(address account) internal view returns (bool)
              {\n uint256 size;\n assembly {\n size := extcodesize(account)\n }\n return size \u003e 0;\n }\n\n
              function performEthTransfer(address recipient, uint256 amount) internal {\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\u0027t 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 \u003e 0) {\n require(abi.decode(returndata, (bool)),
              \"TOKEN_OPERATION_FAILED\");\n }\n }\n\n /*\n Validates that the passed contract address is of a real contract,\n and that
              its id hash (as infered fromn identify()) matched the expected one.\n */\n function validateContractId(address contractAddress, bytes32
              expectedIdHash) internal {\n require(isContract(contractAddress), \"ADDRESS_NOT_CONTRACT\");\n (bool success, bytes memory returndata
              ) = contractAddress.call( // NOLINT: low-level-calls.\n abi.encodeWithSignature(\"identify()\")\n );\n require(success,
              \"FAILED_TO_IDENTIFY_CONTRACT\");\n string memory realContractId = abi.decode(returndata, (string));\n require(\n
              keccak256(abi.encodePacked(realContractId)) == expectedIdHash,\n \"UNEXPECTED_CONTRACT_IDENTIFIER\"\n );\n }\n}\n\n/*\n II.
              StarkExTypes - Common data types.\n*/\nlibrary StarkExTypes {\n // Structure representing a list of verifiers (validity/availability).\n // A
              statement is valid only if all the verifiers in the list agree on it.\n // Adding a verifier to the list is immediate - this is used for fast
              resolution of\n // any soundness issues.\n // Removing from the list is time-locked, to ensure that any user of the system\n // not
              content with the announced removal has ample time to leave the system before it is\n // removed.\n struct ApprovalChainData {\n
              address[] list;\n // Represents the time after which the verifier with the given address can be removed.\n // Removal of the verifier
              with address A is allowed only in the case the value\n // of unlockedForRemovalTime[A] != 0 and unlockedForRemovalTime[A] \u003c (current
              time).\n mapping(address =\u003e uint256) unlockedForRemovalTime;\n }\n}\n"},"Governance.sol":{"content":"/*\n Copyright 2019-2021
              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.6.12;\n\nimport \"MGovernance.sol\";\n\n/*\n Implements Generic Governance, applicable
              for both proxy and main contract, and possibly others.\n Notes:\n The use of the same function names by both the Proxy and a delegated
              implementation\n is not possible since calling the implementation functions is done via the default function\n of the Proxy. For this reason,
              for example, the implementation of MainContract (MainGovernance)\n exposes mainIsGovernor, which calls the internal isGovernor method.\n
              */\nabstract contract Governance is MGovernance {\n event LogNominatedGovernor(address nominatedGovernor);\n event LogNewGovernorAccepted
              (address acceptedGovernor);\n event LogRemovedGovernor(address removedGovernor);\n event LogNominationCancelled();\n\n function
              getGovernanceInfo() internal view virtual returns (GovernanceInfoStruct storage);\n\n /*\n Current code intentionally prevents governance
              re-initialization.\n This may be a problem in an upgrade situation, in a case that the upgrade-to implementation\n performs an
              initialization (for real) and within that calls initGovernance().\n\n Possible workarounds:\n 1. Clearing the governance info altogether
              by changing the MAIN_GOVERNANCE_INFO_TAG.\n This will remove existing main governance information.\n 2. Modify the require part in
              this function, so that it will exit quietly\n when trying to re-initialize (uncomment the lines below).\n */\n function
              initGovernance() internal {\n GovernanceInfoStruct storage gub = getGovernanceInfo();\n require(!gub.initialized,
              \"ALREADY_INITIALIZED\");\n gub.initialized = true; // to ensure addGovernor() won\u0027t fail.\n // Add the initial governer.\n
               addGovernor(msg.sender);\n }\n\n function isGovernor(address testGovernor) internal view override returns (bool) {\n
              GovernanceInfoStruct storage gub = getGovernanceInfo();\n return gub.effectiveGovernors[testGovernor];\n }\n\n /*\n Cancels the
              nomination of a governor candidate.\n */\n function cancelNomination() internal onlyGovernance {\n GovernanceInfoStruct storage gub =
              getGovernanceInfo();\n gub.candidateGovernor = address(0x0);\n emit LogNominationCancelled();\n }\n\n function
              nominateNewGovernor(address newGovernor) internal onlyGovernance {\n GovernanceInfoStruct storage gub = getGovernanceInfo();\n
              require(!isGovernor(newGovernor), \"ALREADY_GOVERNOR\");\n gub.candidateGovernor = newGovernor;\n emit LogNominatedGovernor
              (newGovernor);\n }\n\n /*\n The addGovernor is called in two cases:\n 1. by acceptGovernance when a new governor accepts its role
              .\n 2. by initGovernance to add the initial governor.\n The difference is that the init path skips the nominate step\n that would
              fail because of the onlyGovernance modifier.\n */\n function addGovernor(address newGovernor) private {\n require(!isGovernor
              (newGovernor), \"ALREADY_GOVERNOR\");\n GovernanceInfoStruct storage gub = getGovernanceInfo();\n gub.effectiveGovernors[newGovernor]
              = true;\n }\n\n function acceptGovernance() internal {\n // The new governor was proposed as a candidate by the current governor.\n
               GovernanceInfoStruct storage gub = getGovernanceInfo();\n require(msg.sender == gub.candidateGovernor, \"ONLY_CANDIDATE_GOVERNOR\"
              );\n\n // Update state.\n addGovernor(gub.candidateGovernor);\n gub.candidateGovernor = address(0x0);\n\n // Send a
              notification about the change of governor.\n emit LogNewGovernorAccepted(msg.sender);\n }\n\n /*\n Remove a governor from office
              .\n */\n function removeGovernor(address governorForRemoval) internal onlyGovernance {\n require(msg.sender != governorForRemoval,
              \"GOVERNOR_SELF_REMOVE\");\n GovernanceInfoStruct storage gub = getGovernanceInfo();\n require(isGovernor(governorForRemoval),
              \"NOT_GOVERNOR\");\n gub.effectiveGovernors[governorForRemoval] = false;\n emit LogRemovedGovernor(governorForRemoval);\n }\n}\n"}
              ,"GovernanceStorage.sol":{"content":"/*\n Copyright 2019-2021 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.6.12;\nimport
              \"MGovernance.sol\";\n\n/*\n Holds the governance slots for ALL entities, including proxy and the main contract.\n*/\ncontract GovernanceStorage
              {\n // A map from a Governor tag to its own GovernanceInfoStruct.\n mapping(string =\u003e GovernanceInfoStruct) internal governanceInfo;
              //NOLINT uninitialized-state.\n}\n"},"MGovernance.sol":{"content":"/*\n Copyright 2019-2021 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.6.12;\n\nstruct GovernanceInfoStruct {\n mapping(address =\u003e bool) effectiveGovernors;\n address candidateGovernor
              ;\n bool initialized;\n}\n\nabstract contract MGovernance {\n function isGovernor(address testGovernor) internal view virtual returns (bool
              );\n\n /*\n Allows calling the function only by a Governor.\n */\n modifier onlyGovernance() {\n require(isGovernor(msg.sender
              ), \"ONLY_GOVERNANCE\");\n _;\n }\n}\n"},"Proxy.sol":{"content":"/*\n Copyright 2019-2021 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.6.12;\n\nimport \"ProxyGovernance.sol\";\nimport \"ProxyStorage.sol\";\nimport \"StorageSlots.sol\";\nimport \"Common.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 It is the responsibility of the
              implementation not to overwrite any storage belonging to the\n proxy (`ProxyStorage`). In addition, upon upgrade, the new implementation is
              assumed to be\n backward compatible with previous implementations with respect to the storage used until that\n point.\n*/\ncontract Proxy is
              ProxyStorage, ProxyGovernance, StorageSlots {\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 string public constant PROXY_VERSION = \"3.0.0\";\n\n constructor(uint256 upgradeActivationDelay) public {\n
               initGovernance();\n setUpgradeActivationDelay(upgradeActivationDelay);\n }\n\n function setUpgradeActivationDelay(uint256
              delayInSeconds) private {\n bytes32 slot = UPGRADE_DELAY_SLOT;\n assembly {\n sstore(slot, delayInSeconds)\n }\n
               }\n\n function getUpgradeActivationDelay() public view returns (uint256 delay) {\n bytes32 slot = UPGRADE_DELAY_SLOT;\n assembly
              {\n delay := sload(slot)\n }\n return delay;\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\u0027t call low level implementation before it\u0027s
              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\u0027t expect to receive such, thus block them.\n */\n receive() external payable {\n
               revert(\"CONTRACT_NOT_EXPECTED_TO_RECEIVE\");\n }\n\n /*\n Contract\u0027s 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\u0027t 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 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 onlyGovernance {\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\n // First implementation should not
              have time-lock.\n if (implementation() == address(0x0)) {\n activationTime = block.timestamp;\n }\n\n
              enabledTime[implVectorHash] = activationTime;\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\u0027t 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 onlyGovernance {\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 \u003e 0, \"UNKNOWN_UPGRADE_INFORMATION\");\n delete
              enabledTime[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
              onlyGovernance notFinalized notFrozen {\n bytes32 implVectorHash = keccak256(abi.encode(newImplementation, data, finalize));\n
              uint256 activationTime = enabledTime[implVectorHash];\n require(activationTime \u003e 0, \"UNKNOWN_UPGRADE_INFORMATION\");\n require
              (newImplementation.isContract(), \"ADDRESS_NOT_CONTRACT\");\n // NOLINTNEXTLINE: timestamp.\n require(activationTime \u003c= block
              .timestamp, \"UPGRADE_NOT_ENABLED_YET\");\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 if (finalize) {\n setFinalizedFlag();\n
              emit FinalizedImplementation(newImplementation);\n }\n\n emit ImplementationUpgraded(newImplementation, data);\n }\n}\n"}
              ,"ProxyGovernance.sol":{"content":"/*\n Copyright 2019-2021 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.6.12
              ;\n\nimport \"Governance.sol\";\nimport \"GovernanceStorage.sol\";\n\n/**\n The Proxy contract is governed by one or more Governors of which the
              initial one is the\n deployer of the contract.\n\n A governor has the sole authority to perform the following operations:\n\n 1. Nominate
              additional governors (:sol:func:`proxyNominateNewGovernor`)\n 2. Remove other governors (:sol:func:`proxyRemoveGovernor`)\n 3. Add new
              `implementations` (proxied contracts)\n 4. Remove (new or old) `implementations`\n 5. Update `implementations` after a timelock allows it\n\n
              Adding governors is performed in a two step procedure:\n\n 1. First, an existing governor nominates a new governor (:sol:func
              :`proxyNominateNewGovernor`)\n 2. Then, the new governor must accept governance to become a governor (:sol:func:`proxyAcceptGovernance`)\n\n This
              two step procedure ensures that a governor public key cannot be nominated unless there is an\n entity that has the corresponding private key. This
              is intended to prevent errors in the addition\n process.\n\n The governor private key should typically be held in a secure cold wallet or managed
              via a\n multi-sig contract.\n*/\n/*\n Implements Governance for the proxy contract.\n It is a thin wrapper to the Governance contract,\n which
              is needed so that it can have non-colliding function names,\n and a specific tag (key) to allow unique state storage.\n*/\ncontract
              ProxyGovernance is GovernanceStorage, Governance {\n // The tag is the string key that is used in the Governance storage mapping.\n string
              public constant PROXY_GOVERNANCE_TAG = \"StarkEx.Proxy.2019.GovernorsInformation\";\n\n /*\n Returns the GovernanceInfoStruct associated
              with the governance tag.\n */\n function getGovernanceInfo() internal view override returns (GovernanceInfoStruct storage) {\n return
              governanceInfo[PROXY_GOVERNANCE_TAG];\n }\n\n function proxyIsGovernor(address testGovernor) external view returns (bool) {\n return
              isGovernor(testGovernor);\n }\n\n function proxyNominateNewGovernor(address newGovernor) external {\n nominateNewGovernor(newGovernor
              );\n }\n\n function proxyRemoveGovernor(address governorForRemoval) external {\n removeGovernor(governorForRemoval);\n }\n\n
              function proxyAcceptGovernance() external {\n acceptGovernance();\n }\n\n function proxyCancelNomination() external {\n
              cancelNomination();\n }\n}\n"},"ProxyStorage.sol":{"content":"/*\n Copyright 2019-2021 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.6.12;\n\nimport \"GovernanceStorage.sol\";\n\n/*\n Holds the Proxy-specific state variables.\n This contract is inherited by the
              GovernanceStorage (and indirectly by MainStorage)\n to prevent collision hazard.\n*/\ncontract ProxyStorage is GovernanceStorage {\n //
              NOLINTNEXTLINE: naming-convention uninitialized-state.\n mapping(address =\u003e bytes32) internal initializationHash_DEPRECATED;\n\n // The
              time after which we can switch to the implementation.\n // Hash(implementation, data, finalize) =\u003e time.\n mapping(bytes32 =\u003e
              uint256) internal enabledTime;\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 mapping(bytes32 =\u003e bool) internal initialized;\n}\n"},"StorageSlots.sol":{"content":"/*\n Copyright 2019-2021 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.6.12;\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 // The address of the slot is keccak256
              (\"StarkWare2019.implemntation-slot\").\n // We need to keep this variable stored outside of the commonly used space,\n // so that it\u0027s
              not overrun by the logical implementation (the proxied contract).\n bytes32 internal constant IMPLEMENTATION_SLOT =\n
              0x177667240aeeea7e35eabe3a35e18306f336219e1386f7710a6bf8783f761b24;\n\n // Storage slot with the address of the call-proxy current
              implementation.\n // The address of the slot is keccak256(\"\u0027StarkWare2020.CallProxy.Implemntation.Slot\u0027\").\n // We need to keep
              this variable stored outside of the commonly used space.\n // so that it\u0027s not overrun by the logical implementation (the proxied contract
              ).\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.solidityKeccak([\u0027string\u0027],
              [\"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.solidityKeccak([\u0027string\u0027], [\u0027StarkWare.Upgradibility
              .Delay.Slot\u0027]).\n bytes32 public constant UPGRADE_DELAY_SLOT =\n 0xc21dbb3089fcb2c4f4c6a67854ab4db2b0f233ea4b21b21f912d52d18fc5db1f
              ;\n}\n"}}
          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

          File 3 of 4: StarknetEthBridge
          1
          {"BlockDirectCall.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\n\n/*\n
               This contract provides means to block direct call of an external function.\n A derived contract (e.g. MainDispatcherBase) should decorate
              sensitive functions with the\n notCalledDirectly modifier, thereby preventing it from being called directly, and allowing only calling\n using
              delegate_call.\n*/\nabstract contract BlockDirectCall {\n address immutable this_;\n\n constructor() internal {\n this_ = address(this
              );\n }\n\n modifier notCalledDirectly() {\n require(this_ != address(this), \"DIRECT_CALL_DISALLOWED\");\n _;\n }\n}\n"}
              ,"CairoConstants.sol":{"content":"/*\n Copyright 2019-2022 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*/\npragma solidity ^0.6.12;\n\nlibrary CairoConstants {\n uint256 public
              constant FIELD_PRIME =\n 0x800000000000011000000000000000000000000000000000000000000000001;\n}\n"},"Common.sol":{"content":"/*\n Copyright
              2019-2022 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.6.12;\n\n/*\n Common Utility librarries.\n I. Addresses (extending
              address).\n*/\nlibrary Addresses {\n function isContract(address account) internal view returns (bool) {\n uint256 size;\n
              assembly {\n size := extcodesize(account)\n }\n return size \u003e 0;\n }\n\n function performEthTransfer(address
              recipient, uint256 amount) internal {\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\u0027t 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 \u003e 0) {\n require(abi.decode(returndata, (bool)), \"TOKEN_OPERATION_FAILED\");\n
               }\n }\n\n /*\n Validates that the passed contract address is of a real contract,\n and that its id hash (as infered fromn
              identify()) matched the expected one.\n */\n function validateContractId(address contractAddress, bytes32 expectedIdHash) internal {\n
               require(isContract(contractAddress), \"ADDRESS_NOT_CONTRACT\");\n (bool success, bytes memory returndata) = contractAddress.call( // NOLINT
              : low-level-calls.\n abi.encodeWithSignature(\"identify()\")\n );\n require(success, \"FAILED_TO_IDENTIFY_CONTRACT\");\n
               string memory realContractId = abi.decode(returndata, (string));\n require(\n keccak256(abi.encodePacked(realContractId))
              == expectedIdHash,\n \"UNEXPECTED_CONTRACT_IDENTIFIER\"\n );\n }\n}\n\n/*\n II. StarkExTypes - Common data types.\n
              */\nlibrary StarkExTypes {\n // Structure representing a list of verifiers (validity/availability).\n // A statement is valid only if all the
              verifiers in the list agree on it.\n // Adding a verifier to the list is immediate - this is used for fast resolution of\n // any soundness
              issues.\n // Removing from the list is time-locked, to ensure that any user of the system\n // not content with the announced removal has
              ample time to leave the system before it is\n // removed.\n struct ApprovalChainData {\n address[] list;\n // Represents the
              time after which the verifier with the given address can be removed.\n // Removal of the verifier with address A is allowed only in the case
              the value\n // of unlockedForRemovalTime[A] != 0 and unlockedForRemovalTime[A] \u003c (current time).\n mapping(address =\u003e
              uint256) unlockedForRemovalTime;\n }\n}\n"},"ContractInitializer.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\n\n/**\n Interface for contract initialization.\n The functions it exposes are the app
              specific parts of the contract initialization,\n and are called by the ProxySupport contract that implement the generic part of behind-proxy\n
              initialization.\n*/\nabstract contract ContractInitializer {\n /*\n The number of sub-contracts that the proxied contract consists of.\n
               */\n function numOfSubContracts() internal pure virtual returns (uint256);\n\n /*\n Indicates if the proxied contract has already been
              initialized.\n Used to prevent re-init.\n */\n function isInitialized() internal view virtual returns (bool);\n\n /*\n Validates
              the init data that is passed into the proxied contract.\n */\n function validateInitData(bytes calldata data) internal pure virtual;\n\n
              /*\n For a proxied contract that consists of sub-contracts, this function processes\n the sub-contract addresses, e.g. validates them,
              stores them etc.\n */\n function processSubContractAddresses(bytes calldata subContractAddresses) internal virtual;\n\n /*\n This
              function applies the logic of initializing the proxied contract state,\n e.g. setting root values etc.\n */\n function
              initializeContractState(bytes calldata data) internal virtual;\n}\n"},"GenericGovernance.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\n\nimport \"Governance.sol\";\n\ncontract GenericGovernance is Governance {\n
              bytes32 immutable GOVERNANCE_INFO_TAG_HASH;\n\n constructor(string memory governanceContext) public {\n GOVERNANCE_INFO_TAG_HASH =
              keccak256(abi.encodePacked(governanceContext));\n }\n\n /*\n Returns the GovernanceInfoStruct associated with the governance tag.\n
              */\n function getGovernanceInfo() internal view override returns (GovernanceInfoStruct storage gub) {\n bytes32 location =
              GOVERNANCE_INFO_TAG_HASH;\n assembly {\n gub_slot := location\n }\n }\n\n function isGovernor(address testGovernor)
              external view returns (bool) {\n return _isGovernor(testGovernor);\n }\n\n function nominateNewGovernor(address newGovernor) external
              {\n _nominateNewGovernor(newGovernor);\n }\n\n function removeGovernor(address governorForRemoval) external {\n _removeGovernor
              (governorForRemoval);\n }\n\n function acceptGovernance() external {\n _acceptGovernance();\n }\n\n function cancelNomination()
              external {\n _cancelNomination();\n }\n}\n"},"Governance.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\n\nimport \"MGovernance.sol\";\n\n/*\n Implements Generic Governance, applicable for both proxy
              and main contract, and possibly others.\n Notes:\n The use of the same function names by both the Proxy and a delegated implementation\n is
              not possible since calling the implementation functions is done via the default function\n of the Proxy. For this reason, for example, the
              implementation of MainContract (MainGovernance)\n exposes mainIsGovernor, which calls the internal _isGovernor method.\n*/\nabstract contract
              Governance is MGovernance {\n event LogNominatedGovernor(address nominatedGovernor);\n event LogNewGovernorAccepted(address acceptedGovernor
              );\n event LogRemovedGovernor(address removedGovernor);\n event LogNominationCancelled();\n\n function getGovernanceInfo() internal view
              virtual returns (GovernanceInfoStruct storage);\n\n /*\n Current code intentionally prevents governance re-initialization.\n This may
              be a problem in an upgrade situation, in a case that the upgrade-to implementation\n performs an initialization (for real) and within that
              calls initGovernance().\n\n Possible workarounds:\n 1. Clearing the governance info altogether by changing the MAIN_GOVERNANCE_INFO_TAG
              .\n This will remove existing main governance information.\n 2. Modify the require part in this function, so that it will exit
              quietly\n when trying to re-initialize (uncomment the lines below).\n */\n function initGovernance() internal {\n
              GovernanceInfoStruct storage gub = getGovernanceInfo();\n require(!gub.initialized, \"ALREADY_INITIALIZED\");\n gub.initialized =
              true; // to ensure addGovernor() won\u0027t fail.\n // Add the initial governer.\n addGovernor(msg.sender);\n }\n\n function
              _isGovernor(address testGovernor) internal view override returns (bool) {\n GovernanceInfoStruct storage gub = getGovernanceInfo();\n
               return gub.effectiveGovernors[testGovernor];\n }\n\n /*\n Cancels the nomination of a governor candidate.\n */\n function
              _cancelNomination() internal onlyGovernance {\n GovernanceInfoStruct storage gub = getGovernanceInfo();\n gub.candidateGovernor =
              address(0x0);\n emit LogNominationCancelled();\n }\n\n function _nominateNewGovernor(address newGovernor) internal onlyGovernance {\n
               GovernanceInfoStruct storage gub = getGovernanceInfo();\n require(!_isGovernor(newGovernor), \"ALREADY_GOVERNOR\");\n gub
              .candidateGovernor = newGovernor;\n emit LogNominatedGovernor(newGovernor);\n }\n\n /*\n The addGovernor is called in two cases
              :\n 1. by _acceptGovernance when a new governor accepts its role.\n 2. by initGovernance to add the initial governor.\n The
              difference is that the init path skips the nominate step\n that would fail because of the onlyGovernance modifier.\n */\n function
              addGovernor(address newGovernor) private {\n require(!_isGovernor(newGovernor), \"ALREADY_GOVERNOR\");\n GovernanceInfoStruct storage
              gub = getGovernanceInfo();\n gub.effectiveGovernors[newGovernor] = true;\n }\n\n function _acceptGovernance() internal {\n //
              The new governor was proposed as a candidate by the current governor.\n GovernanceInfoStruct storage gub = getGovernanceInfo();\n
              require(msg.sender == gub.candidateGovernor, \"ONLY_CANDIDATE_GOVERNOR\");\n\n // Update state.\n addGovernor(gub.candidateGovernor
              );\n gub.candidateGovernor = address(0x0);\n\n // Send a notification about the change of governor.\n emit
              LogNewGovernorAccepted(msg.sender);\n }\n\n /*\n Remove a governor from office.\n */\n function _removeGovernor(address
              governorForRemoval) internal onlyGovernance {\n require(msg.sender != governorForRemoval, \"GOVERNOR_SELF_REMOVE\");\n
              GovernanceInfoStruct storage gub = getGovernanceInfo();\n require(_isGovernor(governorForRemoval), \"NOT_GOVERNOR\");\n gub
              .effectiveGovernors[governorForRemoval] = false;\n emit LogRemovedGovernor(governorForRemoval);\n }\n}\n"},"IStarknetMessaging.sol"
              :{"content":"/*\n Copyright 2019-2022 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.6.12;\n\nimport
              \"IStarknetMessagingEvents.sol\";\n\ninterface IStarknetMessaging is IStarknetMessagingEvents {\n /**\n Sends a message to an L2 contract
              .\n\n Returns the hash of the message.\n */\n function sendMessageToL2(\n uint256 toAddress,\n uint256 selector,\n
              uint256[] calldata payload\n ) external returns (bytes32);\n\n /**\n Consumes a message that was sent from an L2 contract.\n\n
              Returns the hash of the message.\n */\n function consumeMessageFromL2(uint256 fromAddress, uint256[] calldata payload)\n external\n
               returns (bytes32);\n\n /**\n Starts the cancellation of an L1 to L2 message.\n A message can be canceled messageCancellationDelay
              () seconds after this function is called.\n\n Note: This function may only be called for a message that is currently pending and the caller\n
               must be the sender of the that message.\n */\n function startL1ToL2MessageCancellation(\n uint256 toAddress,\n uint256
              selector,\n uint256[] calldata payload,\n uint256 nonce\n ) external;\n\n /**\n Cancels an L1 to L2 message, this function
              should be called messageCancellationDelay() seconds\n after the call to startL1ToL2MessageCancellation().\n */\n function
              cancelL1ToL2Message(\n uint256 toAddress,\n uint256 selector,\n uint256[] calldata payload,\n uint256 nonce\n )
              external;\n}\n"},"IStarknetMessagingEvents.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\n\ninterface IStarknetMessagingEvents {\n // This event needs to be compatible with the one defined in Output.sol.\n event
              LogMessageToL1(uint256 indexed fromAddress, address indexed toAddress, uint256[] payload);\n\n // An event that is raised when a message is sent
              from L1 to L2.\n event LogMessageToL2(\n address indexed fromAddress,\n uint256 indexed toAddress,\n uint256 indexed
              selector,\n uint256[] payload,\n uint256 nonce\n );\n\n // An event that is raised when a message from L2 to L1 is consumed.\n
               event ConsumedMessageToL1(\n uint256 indexed fromAddress,\n address indexed toAddress,\n uint256[] payload\n );\n\n
              // An event that is raised when a message from L1 to L2 is consumed.\n event ConsumedMessageToL2(\n address indexed fromAddress,\n
               uint256 indexed toAddress,\n uint256 indexed selector,\n uint256[] payload,\n uint256 nonce\n );\n\n // An event that
              is raised when a message from L1 to L2 Cancellation is started.\n event MessageToL2CancellationStarted(\n address indexed fromAddress,\n
               uint256 indexed toAddress,\n uint256 indexed selector,\n uint256[] payload,\n uint256 nonce\n );\n\n // An event
              that is raised when a message from L1 to L2 is canceled.\n event MessageToL2Canceled(\n address indexed fromAddress,\n uint256
              indexed toAddress,\n uint256 indexed selector,\n uint256[] payload,\n uint256 nonce\n );\n}\n"},"MGovernance.sol"
              :{"content":"/*\n Copyright 2019-2022 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.6.12;\n\nstruct
              GovernanceInfoStruct {\n mapping(address =\u003e bool) effectiveGovernors;\n address candidateGovernor;\n bool initialized;\n}\n\nabstract
              contract MGovernance {\n function _isGovernor(address testGovernor) internal view virtual returns (bool);\n\n /*\n Allows calling the
              function only by a Governor.\n */\n modifier onlyGovernance() {\n require(_isGovernor(msg.sender), \"ONLY_GOVERNANCE\");\n _;\n
               }\n}\n"},"NamedStorage.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\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 bytes32ToUint256Mapping(string memory tag_)\n internal\n pure\n
              returns (mapping(bytes32 =\u003e 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 =\u003e 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 =\u003e 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 =\u003e 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"},"ProxySupport.sol":{"content":"
              /*\n Copyright 2019-2022 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.6.12;\n\nimport \"Governance.sol\";\nimport
              \"Common.sol\";\nimport \"BlockDirectCall.sol\";\nimport \"ContractInitializer.sol\";\n\n/**\n This contract contains the code commonly needed for
              a contract to be deployed behind\n an upgradability proxy.\n It perform the required semantics of the proxy pattern,\n but in a generic manner
              .\n Instantiation of the Governance and of the ContractInitializer, that are the app specific\n part of initialization, has to be done by the
              using contract.\n*/\nabstract contract ProxySupport is Governance, BlockDirectCall, ContractInitializer {\n using Addresses for address;\n\n
              // The two function below (isFrozen \u0026 initialize) needed to bind to the Proxy.\n function isFrozen() external view virtual returns (bool)
              {\n return false;\n }\n\n /*\n The initialize() function serves as an alternative constructor for a proxied deployment.\n\n
              Flow and notes:\n 1. This function cannot be called directly on the deployed contract, but only via\n delegate call.\n 2. If an
              EIC is provided - init is passed onto EIC and the standard init flow is skipped.\n This true for both first intialization or a later one.\n
               3. The data passed to this function is as follows:\n [sub_contracts addresses, eic address, initData].\n\n When calling on an
              initialized contract (no EIC scenario), initData.length must be 0.\n */\n function initialize(bytes calldata data) external notCalledDirectly
              {\n uint256 eicOffset = 32 * numOfSubContracts();\n uint256 expectedBaseSize = eicOffset + 32;\n require(data.length \u003e=
              expectedBaseSize, \"INIT_DATA_TOO_SMALL\");\n address eicAddress = abi.decode(data[eicOffset:expectedBaseSize], (address));\n\n bytes
              calldata subContractAddresses = data[:eicOffset];\n\n processSubContractAddresses(subContractAddresses);\n\n bytes calldata initData
              = data[expectedBaseSize:];\n\n // EIC Provided - Pass initData to EIC and the skip standard init flow.\n if (eicAddress != address
              (0x0)) {\n callExternalInitializer(eicAddress, initData);\n return;\n }\n\n if (isInitialized()) {\n
               require(initData.length == 0, \"UNEXPECTED_INIT_DATA\");\n } else {\n // Contract was not initialized yet.\n
              validateInitData(initData);\n initializeContractState(initData);\n initGovernance();\n }\n }\n\n function
              callExternalInitializer(address externalInitializerAddr, bytes calldata eicData)\n private\n {\n require(externalInitializerAddr
              .isContract(), \"EIC_NOT_A_CONTRACT\");\n\n // NOLINTNEXTLINE: low-level-calls, controlled-delegatecall.\n (bool success, bytes
              memory returndata) = externalInitializerAddr.delegatecall(\n abi.encodeWithSelector(this.initialize.selector, eicData)\n );\n
               require(success, string(returndata));\n require(returndata.length == 0, string(returndata));\n }\n}\n"},"StarknetBridgeConstatns.sol"
              :{"content":"/*\n Copyright 2019-2022 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.6.12;\n\ncontract
              StarknetBridgeConstatns {\n // The selector of the deposit handler in L2.\n uint256 constant DEPOSIT_SELECTOR =\n
              1285101517810983806491589552491143496277809242732141897358598292095611420389;\n uint256 constant TRANSFER_FROM_STARKNET = 0;\n uint256
              constant UINT256_PART_SIZE_BITS = 128;\n uint256 constant UINT256_PART_SIZE = 2**UINT256_PART_SIZE_BITS;\n string constant GOVERNANCE_TAG =
              \"STARKWARE_DEFAULT_GOVERNANCE_INFO\";\n}\n"},"StarknetEthBridge.sol":{"content":"/*\n Copyright 2019-2022 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.6.12;\n\nimport \"Common.sol\";\nimport \"StarknetTokenBridge.sol\";\n\ncontract StarknetEthBridge is
              StarknetTokenBridge {\n using Addresses for address;\n\n function deposit(uint256 l2Recipient) external payable {\n // The msg.value
              in this transaction was already credited to the contract.\n require(address(this).balance \u003c= maxTotalBalance(),
              \"MAX_BALANCE_EXCEEDED\");\n sendMessage(msg.value, l2Recipient);\n }\n\n function withdraw(uint256 amount, address recipient) public
              override {\n // Make sure we don\u0027t accidentally burn funds.\n require(recipient != address(0x0), \"INVALID_RECIPIENT\");\n\n
               // The call to consumeMessage will succeed only if a matching L2-\u003eL1 message\n // exists and is ready for consumption.\n
              consumeMessage(amount, recipient);\n recipient.performEthTransfer(amount);\n }\n\n function transferOutFunds(uint256 amount, address
              recipient) internal override {\n recipient.performEthTransfer(amount);\n }\n}\n"},"StarknetTokenBridge.sol":{"content":"/*\n Copyright
              2019-2022 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.6.12;\n\nimport \"GenericGovernance.sol\";\nimport \"ContractInitializer
              .sol\";\nimport \"ProxySupport.sol\";\nimport \"CairoConstants.sol\";\nimport \"StarknetBridgeConstatns.sol\";\nimport \"StarknetTokenStorage.sol\"
              ;\nimport \"IStarknetMessaging.sol\";\n\nabstract contract StarknetTokenBridge is\n StarknetTokenStorage,\n StarknetBridgeConstatns,\n
              GenericGovernance,\n ContractInitializer,\n ProxySupport\n{\n event LogDeposit(address indexed sender, uint256 amount, uint256 indexed
              l2Recipient);\n event LogDepositCancelRequest(\n address indexed sender,\n uint256 amount,\n uint256 indexed l2Recipient,\n
               uint256 nonce\n );\n event LogDepositReclaimed(\n address indexed sender,\n uint256 amount,\n uint256 indexed
              l2Recipient,\n uint256 nonce\n );\n event LogWithdrawal(address indexed recipient, uint256 amount);\n event LogSetL2TokenBridge
              (uint256 value);\n event LogSetMaxTotalBalance(uint256 value);\n event LogSetMaxDeposit(uint256 value);\n\n function withdraw(uint256
              amount, address recipient) public virtual;\n\n function transferOutFunds(uint256 amount, address recipient) internal virtual;\n\n /*\n
              The constructor is in use here only to set the immutable tag in GenericGovernance.\n */\n constructor() internal GenericGovernance
              (GOVERNANCE_TAG) {}\n\n function isInitialized() internal view override returns (bool) {\n return messagingContract() !=
              IStarknetMessaging(0);\n }\n\n function numOfSubContracts() internal pure override returns (uint256) {\n return 0;\n }\n\n
              function validateInitData(bytes calldata data) internal pure override {\n require(data.length == 64, \"ILLEGAL_DATA_SIZE\");\n }\n\n
              /*\n No processing needed, as there are no sub-contracts to this contract.\n */\n function processSubContractAddresses(bytes calldata
              subContractAddresses) internal override {}\n\n /*\n Gets the addresses of bridgedToken \u0026 messagingContract from the ProxySupport
              initialize(),\n and sets the storage slot accordingly.\n */\n function initializeContractState(bytes calldata data) internal override
              {\n (address bridgedToken_, IStarknetMessaging messagingContract_) = abi.decode(\n data,\n (address,
              IStarknetMessaging)\n );\n bridgedToken(bridgedToken_);\n messagingContract(messagingContract_);\n }\n\n modifier
              isValidL2Address(uint256 l2Address) {\n require(l2Address != 0, \"L2_ADDRESS_OUT_OF_RANGE\");\n require(l2Address \u003c
              CairoConstants.FIELD_PRIME, \"L2_ADDRESS_OUT_OF_RANGE\");\n _;\n }\n\n modifier l2TokenBridgeNotSet() {\n require(l2TokenBridge
              () == 0, \"L2_TOKEN_CONTRACT_ALREADY_SET\");\n _;\n }\n\n modifier l2TokenBridgeSet() {\n require(l2TokenBridge() != 0,
              \"L2_TOKEN_CONTRACT_NOT_SET\");\n _;\n }\n\n function onlyDepositor(uint256 nonce) internal {\n require(depositors()[nonce] ==
              msg.sender, \"ONLY_DEPOSITOR\");\n }\n\n function setL2TokenBridge(uint256 l2TokenBridge_)\n external\n l2TokenBridgeNotSet\n
               isValidL2Address(l2TokenBridge_)\n onlyGovernance\n {\n emit LogSetL2TokenBridge(l2TokenBridge_);\n l2TokenBridge
              (l2TokenBridge_);\n }\n\n /*\n Sets the maximum allowed balance of the bridge.\n\n Note: It is possible to set a lower value than
              the current total balance.\n In this case, deposits will not be possible, until enough withdrawls are done, such that the\n total balance
              gets below the limit.\n */\n function setMaxTotalBalance(uint256 maxTotalBalance_) external onlyGovernance {\n emit
              LogSetMaxTotalBalance(maxTotalBalance_);\n maxTotalBalance(maxTotalBalance_);\n }\n\n function setMaxDeposit(uint256 maxDeposit_)
              external onlyGovernance {\n emit LogSetMaxDeposit(maxDeposit_);\n maxDeposit(maxDeposit_);\n }\n\n function
              depositMessagePayload(uint256 amount, uint256 l2Recipient)\n private\n returns (uint256[] memory)\n {\n uint256[] memory
              payload = new uint256[](3);\n payload[0] = l2Recipient;\n payload[1] = amount \u0026 (UINT256_PART_SIZE - 1);\n payload[2] =
              amount \u003e\u003e UINT256_PART_SIZE_BITS;\n return payload;\n }\n\n function sendMessage(uint256 amount, uint256 l2Recipient)\n
               internal\n l2TokenBridgeSet\n isValidL2Address(l2Recipient)\n {\n require(amount \u003c= maxDeposit(),
              \"TRANSFER_TO_STARKNET_AMOUNT_EXCEEDED\");\n emit LogDeposit(msg.sender, amount, l2Recipient);\n\n (bool success, bytes memory
              returndata) = address(messagingContract()).staticcall(\n abi.encodeWithSignature(\"l1ToL2MessageNonce()\")\n );\n require
              (success, string(returndata));\n uint256 nonce = abi.decode(returndata, (uint256));\n messagingContract().sendMessageToL2(\n
               l2TokenBridge(),\n DEPOSIT_SELECTOR,\n depositMessagePayload(amount, l2Recipient)\n );\n require(depositors
              ()[nonce] == address(0x0), \"DEPOSIT_ALREADY_REGISTERED\");\n depositors()[nonce] = msg.sender;\n }\n\n function consumeMessage
              (uint256 amount, address recipient) internal {\n emit LogWithdrawal(recipient, amount);\n\n uint256[] memory payload = new uint256[]
              (4);\n payload[0] = TRANSFER_FROM_STARKNET;\n payload[1] = uint256(recipient);\n payload[2] = amount \u0026 (UINT256_PART_SIZE
              - 1);\n payload[3] = amount \u003e\u003e UINT256_PART_SIZE_BITS;\n\n messagingContract().consumeMessageFromL2(l2TokenBridge(),
              payload);\n }\n\n function withdraw(uint256 amount) external {\n withdraw(amount, msg.sender);\n }\n\n /*\n A deposit
              cancellation requires two steps:\n 1. The depositor should send a depositCancelRequest request with deposit details \u0026 nonce.\n 2.
              After a certain threshold time, (cancellation delay), they can claim back the funds\n by calling depositReclaim (using the same arguments
              ).\n\n The nonce should be extracted from the LogMessageToL2 event that was emitted by the\n StarknetMessaging contract upon deposit.\n\n
               Note: As long as the depositReclaim was not performed, the deposit may be processed,\n even if the cancellation delay time as
              already passed.\n */\n function depositCancelRequest(\n uint256 amount,\n uint256 l2Recipient,\n uint256 nonce\n )
              external {\n messagingContract().startL1ToL2MessageCancellation(\n l2TokenBridge(),\n DEPOSIT_SELECTOR,\n
              depositMessagePayload(amount, l2Recipient),\n nonce\n );\n\n // Only the depositor is allowed to cancel a deposit.\n
               onlyDepositor(nonce);\n emit LogDepositCancelRequest(msg.sender, amount, l2Recipient, nonce);\n }\n\n function depositReclaim(\n
               uint256 amount,\n uint256 l2Recipient,\n uint256 nonce\n ) external {\n messagingContract().cancelL1ToL2Message(\n
               l2TokenBridge(),\n DEPOSIT_SELECTOR,\n depositMessagePayload(amount, l2Recipient),\n nonce\n );\n\n
               // Only the depositor is allowed to reclaim cancelled deposit funds.\n onlyDepositor(nonce);\n transferOutFunds(amount, msg
              .sender);\n emit LogDepositReclaimed(msg.sender, amount, l2Recipient, nonce);\n }\n}\n"},"StarknetTokenStorage.sol":{"content":"/*\n
              Copyright 2019-2022 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.6.12;\n\nimport \"NamedStorage.sol\";\nimport
              \"IStarknetMessaging.sol\";\n\nabstract contract StarknetTokenStorage {\n // Random storage slot tags.\n string internal constant
              BRIDGED_TOKEN_TAG = \"STARKNET_ERC20_TOKEN_BRIDGE_TOKEN_ADDRESS\";\n string internal constant L2_TOKEN_TAG =
              \"STARKNET_TOKEN_BRIDGE_L2_TOKEN_CONTRACT\";\n string internal constant MAX_DEPOSIT_TAG = \"STARKNET_TOKEN_BRIDGE_MAX_DEPOSIT\";\n string
              internal constant MAX_TOTAL_BALANCE_TAG = \"STARKNET_TOKEN_BRIDGE_MAX_TOTAL_BALANCE\";\n string internal constant MESSAGING_CONTRACT_TAG =
              \"STARKNET_TOKEN_BRIDGE_MESSAGING_CONTRACT\";\n string internal constant DEPOSITOR_ADDRESSES_TAG = \"STARKNET_TOKEN_BRIDGE_DEPOSITOR_ADDRESSES\"
              ;\n\n // Storage Getters.\n function bridgedToken() internal view returns (address) {\n return NamedStorage.getAddressValue
              (BRIDGED_TOKEN_TAG);\n }\n\n function l2TokenBridge() internal view returns (uint256) {\n return NamedStorage.getUintValue
              (L2_TOKEN_TAG);\n }\n\n function maxDeposit() public view returns (uint256) {\n return NamedStorage.getUintValue(MAX_DEPOSIT_TAG);\n
               }\n\n function maxTotalBalance() public view returns (uint256) {\n return NamedStorage.getUintValue(MAX_TOTAL_BALANCE_TAG);\n }\n\n
               function messagingContract() internal view returns (IStarknetMessaging) {\n return IStarknetMessaging(NamedStorage.getAddressValue
              (MESSAGING_CONTRACT_TAG));\n }\n\n // Storage Setters.\n function bridgedToken(address contract_) internal {\n NamedStorage
              .setAddressValueOnce(BRIDGED_TOKEN_TAG, contract_);\n }\n\n function l2TokenBridge(uint256 value) internal {\n NamedStorage
              .setUintValueOnce(L2_TOKEN_TAG, value);\n }\n\n function maxDeposit(uint256 value) internal {\n NamedStorage.setUintValue
              (MAX_DEPOSIT_TAG, value);\n }\n\n function maxTotalBalance(uint256 value) internal {\n NamedStorage.setUintValue(MAX_TOTAL_BALANCE_TAG
              , value);\n }\n\n function messagingContract(IStarknetMessaging contract_) internal {\n NamedStorage.setAddressValueOnce
              (MESSAGING_CONTRACT_TAG, address(contract_));\n }\n\n function depositors() internal pure returns (mapping(uint256 =\u003e address) storage)
              {\n return NamedStorage.uintToAddressMapping(DEPOSITOR_ADDRESSES_TAG);\n }\n}\n"}}
          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

          File 4 of 4: Starknet
          1
          2
          3
          4
          5
          6
          7
          8
          9
          10
          11
          12
          13
          14
          15
          16
          /*
          Copyright 2019-2022 StarkWare Industries Ltd.
          Licensed under the Apache License, Version 2.0 (the "License").
          You may not use this file except in compliance with the License.
          You may obtain a copy of the License at
          https://www.starkware.co/open-source-license/
          Unless required by applicable law or agreed to in writing,
          software distributed under the License is distributed on an "AS IS" BASIS,
          WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
          See the License for the specific language governing permissions
          and limitations under the License.
          */
          // SPDX-License-Identifier: Apache-2.0.
          pragma solidity ^0.6.12;
          /*
          Common Utility Libraries.
          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX