creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "contracts/BL/messaging/BLStandardBridge.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/* Interface Imports */\nimport { IBLStandardBridge } from \"./IBLStandardBridge.sol\";\nimport { IBLERC20Bridge } from \"./IBLERC20Bridge.sol\";\nimport { ISLERC20Bridge } from \"../../SL/messaging/ISLERC20Bridge.sol\";\nimport { INahmiiStandardERC20 } from \"../../standards/INahmiiStandardERC20.sol\";\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/* Library Imports */\nimport { CrossDomainEnabled } from \"../../libraries/bridge/CrossDomainEnabled.sol\";\nimport { Lib_PredeployAddresses } from \"../../libraries/constants/Lib_PredeployAddresses.sol\";\nimport { Address } from \"@openzeppelin/contracts/utils/Address.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport { ERC165Checker } from \"@openzeppelin/contracts/utils/introspection/ERC165Checker.sol\";\n\n/**\n * @title BLStandardBridge\n * @dev The BL ETH and ERC20 bridge is a contract which works together with a corresponding SL\n *      bridge to make it possible to bridge ETH and ERC20 tokens from Ethereum to Nahmii.\n */\ncontract BLStandardBridge is IBLStandardBridge, CrossDomainEnabled {\n    using SafeERC20 for IERC20;\n\n    /********************************\n     * External Contract References *\n     ********************************/\n\n    address public remoteTokenBridge;\n    uint256 public remoteChainId;\n\n    // Maps BL token to SL token to balance of the BL token locked\n    mapping(address => mapping(address => uint256)) public locks;\n\n    /***************\n     * Constructor *\n     ***************/\n\n    // This contract lives behind a proxy, so the constructor parameters will go unused.\n    constructor() CrossDomainEnabled(address(0)) {}\n\n    /******************\n     * Initialization *\n     ******************/\n\n    /**\n     * @param _localMessenger BL Messenger address being used for cross-chain communications.\n     * @param _remoteTokenBridge Address of the SL bridge deployed to the remote chain.\n     * @param _remoteChainId ID of the remote chain.\n     */\n    // slither-disable-next-line external-function\n    function initialize(\n        address _localMessenger,\n        address _remoteTokenBridge,\n        uint256 _remoteChainId\n    ) public {\n        require(messenger == address(0), \"Contract has already been initialized.\");\n        messenger = _localMessenger;\n        remoteTokenBridge = _remoteTokenBridge;\n        remoteChainId = _remoteChainId;\n    }\n\n    /**************\n     * Bridging *\n     **************/\n\n    /**\n     * @dev Modifier requiring sender to be EOA.  This check could be bypassed by a malicious\n     * contract via initcode, but it takes care of the user error we want to avoid.\n     */\n    modifier onlyEOA() {\n        // Used to stop bridging from contracts (avoid accidentally lost tokens)\n        require(!Address.isContract(msg.sender), \"Account not EOA\");\n        _;\n    }\n\n    /**\n     * @dev This function can be called with no data\n     * to bridge an amount of ETH to the caller's balance on SL.\n     * Since the receive function doesn't take data, a conservative\n     * default amount is forwarded to SL.\n     */\n    receive() external payable onlyEOA {\n        _initiateETHBridge(msg.sender, msg.sender, 0, 200_000, bytes(\"\"));\n    }\n\n    /**\n     * @inheritdoc IBLStandardBridge\n     */\n    function bridgeETH(\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external payable onlyEOA {\n        _initiateETHBridge(msg.sender, msg.sender, _localGasLimit, _remoteGasLimit, _data);\n    }\n\n    /**\n     * @inheritdoc IBLStandardBridge\n     */\n    function bridgeETHTo(\n        address _to,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external payable {\n        _initiateETHBridge(msg.sender, _to, _localGasLimit, _remoteGasLimit, _data);\n    }\n\n    /**\n     * @dev Performs the logic for bridging by storing the ETH and informing the SL ETH Gateway of\n     * the bridge.\n     * @param _from Account to pull the ETH from on BL.\n     * @param _to Account to give the ETH to on SL.\n     * @param _localGasLimit Minimum gas limit for the reverse bridge message on this domain.\n     * @param _remoteGasLimit Minimum gas limit for the bridge message on the other domain.\n     * @param _data Optional data to forward to SL. This data is provided\n     *        solely as a convenience for external contracts. Aside from enforcing a maximum\n     *        length, these contracts provide no guarantees about its content.\n     */\n    function _initiateETHBridge(\n        address _from,\n        address _to,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes memory _data\n    ) internal {\n        // Construct calldata for finalizeBridge call\n        bytes memory message = abi.encodeWithSelector(\n            ISLERC20Bridge.finalizeBridge.selector,\n            address(0),\n            Lib_PredeployAddresses.NVM_ETH,\n            _from,\n            _to,\n            msg.value,\n            0,\n            _localGasLimit,\n            _remoteGasLimit,\n            _data\n        );\n\n        // Send calldata into SL\n        // slither-disable-next-line reentrancy-events\n        sendCrossDomainMessage(remoteTokenBridge, _remoteGasLimit, message);\n\n        // slither-disable-next-line reentrancy-events\n        emit ETHBridgeInitiated(_from, _to, msg.value, _localGasLimit, _remoteGasLimit, _data);\n    }\n\n    /**\n     * @inheritdoc IBLERC20Bridge\n     */\n    function bridgeERC20(\n        address _localToken,\n        address _remoteToken,\n        uint256 _amount,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external payable virtual onlyEOA {\n        _initiateERC20Bridge(\n            _localToken,\n            _remoteToken,\n            msg.sender,\n            msg.sender,\n            _amount,\n            msg.value,\n            _localGasLimit,\n            _remoteGasLimit,\n            _data\n        );\n    }\n\n    /**\n     * @inheritdoc IBLERC20Bridge\n     */\n    function bridgeERC20To(\n        address _localToken,\n        address _remoteToken,\n        address _to,\n        uint256 _amount,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external payable virtual {\n        _initiateERC20Bridge(\n            _localToken,\n            _remoteToken,\n            msg.sender,\n            _to,\n            _amount,\n            msg.value,\n            _localGasLimit,\n            _remoteGasLimit,\n            _data\n        );\n    }\n\n    /**\n     * @dev Performs the logic for bridging by informing the remote bridge\n     * contract of the bridge and lock or burn the local funds.\n     * @param _localToken Address of the BL ERC20 we are bridging\n     * @param _remoteToken Address of the BL respective SL ERC20\n     * @param _from Account to pull the ERC20 from on BL\n     * @param _to Account to give the ERC20 to on SL\n     * @param _amount Amount of the ERC20 to bridge.\n     * @param _feeAmount Bridge fee in Wei.\n     * @param _localGasLimit Minimum gas limit for the reverse bridge message on this domain.\n     * @param _remoteGasLimit Minimum gas limit for the bridge message on the other domain.\n     * @param _data Optional data to forward to SL. This data is provided\n     *        solely as a convenience for external contracts. Aside from enforcing a maximum\n     *        length, these contracts provide no guarantees about its content.\n     */\n    function _initiateERC20Bridge(\n        address _localToken,\n        address _remoteToken,\n        address _from,\n        address _to,\n        uint256 _amount,\n        uint256 _feeAmount,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) internal {\n        if (ERC165Checker.supportsInterface(_localToken, type(INahmiiStandardERC20).interfaceId)) {\n            // Check that the remote token is a match of the local token\n            require(\n                _remoteToken == INahmiiStandardERC20(_localToken).remoteToken(remoteChainId),\n                \"BLStandardBridge: remote token does not match given value\"\n            );\n\n            // When a bridge operation is initiated, we burn the sender's local funds.\n            // slither-disable-next-line reentrancy-events\n            INahmiiStandardERC20(_localToken).burn(_from, _amount);\n        } else {\n            // When a bridge operation is initiated, the transfer the sender's local funds to\n            // this bridge.\n            // to itself for future local bridge operation finalizations.\n            // slither-disable-next-line reentrancy-events, reentrancy-benign\n            IERC20(_localToken).safeTransferFrom(_from, address(this), _amount);\n\n            // Mark that the amount of this local/remote token pair is escrowed in\n            // this bridge\n            // slither-disable-next-line reentrancy-benign\n            locks[_localToken][_remoteToken] = locks[_localToken][_remoteToken] + _amount;\n        }\n\n        // Construct calldata for slERC20Bridge.finalizeBridge(...)\n        bytes memory message = abi.encodeWithSelector(\n            ISLERC20Bridge.finalizeBridge.selector,\n            _localToken,\n            _remoteToken,\n            _from,\n            _to,\n            _amount,\n            _feeAmount,\n            _localGasLimit,\n            _remoteGasLimit,\n            _data\n        );\n\n        // Send calldata into SL\n        // slither-disable-next-line reentrancy-events, reentrancy-benign\n        sendCrossDomainMessage(remoteTokenBridge, _remoteGasLimit, message);\n\n        // slither-disable-next-line reentrancy-events\n        emit ERC20BridgeInitiated(\n            _localToken,\n            _remoteToken,\n            _from,\n            _to,\n            _amount,\n            _feeAmount,\n            _localGasLimit,\n            _remoteGasLimit,\n            _data\n        );\n    }\n\n    /*************************\n     * Cross-chain Functions *\n     *************************/\n\n    /**\n     * @inheritdoc IBLStandardBridge\n     */\n    function finalizeETHBridge(\n        address _from,\n        address _to,\n        uint256 _amount,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external onlyFromCrossDomainAccount(remoteTokenBridge) {\n        // slither-disable-next-line reentrancy-events\n        (bool success, ) = _to.call{ value: _amount }(new bytes(0));\n        if (success) {\n            // slither-disable-next-line reentrancy-events\n            emit ETHBridgeFinalized(_from, _to, _amount, _localGasLimit, _remoteGasLimit, _data);\n        } else {\n            // Construct calldata for slERC20Bridge.finalizeBridge(...)\n            bytes memory message = abi.encodeWithSelector(\n                ISLERC20Bridge.finalizeBridge.selector,\n                address(0),\n                Lib_PredeployAddresses.NVM_ETH,\n                _to,\n                _from,\n                _amount,\n                0,\n                _localGasLimit,\n                _remoteGasLimit,\n                _data\n            );\n\n            // Send calldata into SL\n            // slither-disable-next-line reentrancy-events\n            sendCrossDomainMessage(remoteTokenBridge, _remoteGasLimit, message);\n\n            // slither-disable-next-line reentrancy-events\n            emit ETHBridgeFailed(_from, _to, _amount, _localGasLimit, _remoteGasLimit, _data);\n        }\n    }\n\n    /**\n     * @inheritdoc IBLERC20Bridge\n     */\n    function finalizeERC20Bridge(\n        address _localToken,\n        address _remoteToken,\n        address _from,\n        address _to,\n        uint256 _amount,\n        uint256 _feeAmount,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external onlyFromCrossDomainAccount(remoteTokenBridge) {\n        require(_localToken != address(this), \"BLStandardBridge: local token cannot be self\");\n\n        if (\n            ERC165Checker.supportsInterface(_localToken, type(INahmiiStandardERC20).interfaceId) &&\n            _remoteToken == INahmiiStandardERC20(_localToken).remoteToken(remoteChainId)\n        ) {\n            // When a bridge operation is finalized, we mint local funds to the recipient.\n            INahmiiStandardERC20(_localToken).mint(_to, _amount);\n\n            // slither-disable-next-line reentrancy-events\n            emit ERC20BridgeFinalized(\n                _localToken,\n                _remoteToken,\n                _from,\n                _to,\n                _amount,\n                _feeAmount,\n                _localGasLimit,\n                _remoteGasLimit,\n                _data\n            );\n        } else if (locks[_localToken][_remoteToken] >= _amount) {\n            // Mark that the amount of local/remote token pair is no longer escrowed in\n            // this bridge\n            locks[_localToken][_remoteToken] = locks[_localToken][_remoteToken] - _amount;\n\n            // When a bridge operation is finalized, we transfer the funds to the recipient.\n            IERC20(_localToken).safeTransfer(_to, _amount);\n\n            // slither-disable-next-line reentrancy-events\n            emit ERC20BridgeFinalized(\n                _localToken,\n                _remoteToken,\n                _from,\n                _to,\n                _amount,\n                _feeAmount,\n                _localGasLimit,\n                _remoteGasLimit,\n                _data\n            );\n        } else {\n            // This case could happen if there is a malicious local token, or if a user somehow\n            // specified the wrong local token address to bridge into.\n            // In either case, we stop the process here and construct a message to\n            // bridge to the remote domain so that users can get their funds out in some cases.\n            // There is no way to prevent malicious token contracts altogether, but this does limit\n            // user error and mitigate some forms of malicious contract behavior.\n\n            // Construct calldata for slERC20Bridge.finalizeBridge(...)\n            bytes memory message = abi.encodeWithSelector(\n                ISLERC20Bridge.finalizeBridge.selector,\n                _localToken,\n                _remoteToken,\n                _to,\n                _from,\n                _amount,\n                _feeAmount,\n                _localGasLimit,\n                _remoteGasLimit,\n                _data\n            );\n\n            // Send message to SL bridge\n            // slither-disable-next-line reentrancy-events, reentrancy-benign\n            sendCrossDomainMessage(remoteTokenBridge, _remoteGasLimit, message);\n\n            // slither-disable-next-line reentrancy-events\n            emit ERC20BridgeFailed(\n                _localToken,\n                _remoteToken,\n                _from,\n                _to,\n                _amount,\n                _feeAmount,\n                _localGasLimit,\n                _remoteGasLimit,\n                _data\n            );\n        }\n    }\n\n    /*****************************\n     * Temporary - Migrating ETH *\n     *****************************/\n\n    /**\n     * @dev Adds ETH balance to the account. This is meant to allow for ETH\n     * to be migrated from an old gateway to a new gateway.\n     * NOTE: This is left for one upgrade only so we are able to receive the migrated ETH from the\n     * old contract\n     */\n    function donateETH() external payable {}\n}\n"
      },
      "contracts/standards/INahmiiStandardERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { IERC165 } from \"@openzeppelin/contracts/utils/introspection/IERC165.sol\";\n\ninterface INahmiiStandardERC20 is IERC20, IERC165 {\n    function remoteToken(uint256) external view returns (address);\n\n    function mint(address _to, uint256 _amount) external;\n\n    function burn(address _from, uint256 _amount) external;\n\n    function native() external returns (bool);\n\n    /**\n     * @notice Initializes a NahmiiStandardERC20 instance to support bridging to the\n     *         given remote network\n     *\n     * @param _remoteChainId Chain ID of the remote network.\n     * @param _localBridge   Address of the remote network's bridge on the local network.\n     * @param _remoteToken   Address of the paired NahmiiStandardERC20 token on the remote network.\n     */\n    function initializeBridge(\n        uint256 _remoteChainId,\n        address _localBridge,\n        address _remoteToken\n    ) external;\n\n    event Mint(address indexed _account, uint256 _amount);\n    event Burn(address indexed _account, uint256 _amount);\n    event InitializeBridge(\n        uint256 indexed _remoteChainId,\n        address indexed _localBridge,\n        address indexed _remoteToken\n    );\n}\n"
      },
      "contracts/BL/messaging/IBLStandardBridge.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\nimport \"./IBLERC20Bridge.sol\";\n\n/**\n * @title IBLStandardBridge\n */\ninterface IBLStandardBridge is IBLERC20Bridge {\n    /**********\n     * Events *\n     **********/\n\n    event ETHBridgeInitiated(\n        address indexed from,\n        address indexed to,\n        uint256 amount,\n        uint32 localGasLimit,\n        uint32 remoteGasLimit,\n        bytes data\n    );\n\n    event ETHBridgeFinalized(\n        address indexed from,\n        address indexed to,\n        uint256 amount,\n        uint32 localGasLimit,\n        uint32 remoteGasLimit,\n        bytes data\n    );\n\n    event ETHBridgeFailed(\n        address indexed from,\n        address indexed to,\n        uint256 amount,\n        uint32 localGasLimit,\n        uint32 remoteGasLimit,\n        bytes data\n    );\n\n    /********************\n     * Public Functions *\n     ********************/\n\n    /**\n     * @dev Initiate a bridge of an amount of the ETH to the caller's balance on SL.\n     * @param _localGasLimit Minimum gas limit for the reverse bridge message on this domain.\n     * @param _remoteGasLimit Minimum gas limit for the bridge message on the other domain.\n     * @param _data Optional data to forward to SL. This data is provided\n     *        solely as a convenience for external contracts. Aside from enforcing a maximum\n     *        length, these contracts provide no guarantees about its content.\n     */\n    function bridgeETH(\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external payable;\n\n    /**\n     * @dev Initiate a bridge of an amount of ETH to a recipient's balance on SL.\n     * @param _to SL address to credit the withdrawal to.\n     * @param _localGasLimit Minimum gas limit for the reverse bridge message on this domain.\n     * @param _remoteGasLimit Minimum gas limit for the bridge message on the other domain.\n     * @param _data Optional data to forward to SL. This data is provided\n     *        solely as a convenience for external contracts. Aside from enforcing a maximum\n     *        length, these contracts provide no guarantees about its content.\n     */\n    function bridgeETHTo(\n        address _to,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external payable;\n\n    /*************************\n     * Cross-chain Functions *\n     *************************/\n\n    /**\n     * @dev Finalize a bridge from SL to BL, and credit funds to the recipient's balance of the\n     * BL ETH token. Since only the xDomainMessenger can call this function, it will never be called\n     * before the bridge is finalized.\n     * @param _from SL address initiating the transfer.\n     * @param _to BL address to credit the ERC20 to.\n     * @param _amount Amount of the ERC20 to bridge.\n     * @param _localGasLimit Minimum gas limit for the reverse bridge message on this domain.\n     * @param _remoteGasLimit Minimum gas limit for the bridge message on the other domain.\n     * @param _data Optional data to forward to SL. This data is provided\n     *        solely as a convenience for external contracts. Aside from enforcing a maximum\n     *        length, these contracts provide no guarantees about its content.\n     */\n    function finalizeETHBridge(\n        address _from,\n        address _to,\n        uint256 _amount,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external;\n}\n"
      },
      "contracts/BL/messaging/IBLERC20Bridge.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title IBLERC20Bridge\n */\ninterface IBLERC20Bridge {\n    /**********\n     * Events *\n     **********/\n\n    event ERC20BridgeInitiated(\n        address indexed localToken,\n        address indexed remoteToken,\n        address indexed from,\n        address to,\n        uint256 amount,\n        uint256 feeAmount,\n        uint32 localGasLimit,\n        uint32 remoteGasLimit,\n        bytes data\n    );\n\n    event ERC20BridgeFinalized(\n        address indexed localToken,\n        address indexed remoteToken,\n        address indexed from,\n        address to,\n        uint256 amount,\n        uint256 feeAmount,\n        uint32 localGasLimit,\n        uint32 remoteGasLimit,\n        bytes data\n    );\n\n    event ERC20BridgeFailed(\n        address indexed localToken,\n        address indexed remoteToken,\n        address indexed from,\n        address to,\n        uint256 amount,\n        uint256 feeAmount,\n        uint32 localGasLimit,\n        uint32 remoteGasLimit,\n        bytes data\n    );\n\n    /********************\n     * Public Functions *\n     ********************/\n\n    /**\n     * @dev get the address of the corresponding SL bridge contract.\n     * @return Address of the corresponding SL bridge contract.\n     */\n    function remoteTokenBridge() external returns (address);\n\n    /**\n     * @dev Initiate a bridge of an amount of the ERC20 to the caller's balance on SL.\n     * @param _localToken Address of the BL ERC20 we are bridging\n     * @param _remoteToken Address of the BL respective SL ERC20\n     * @param _amount Amount of the ERC20 to bridge\n     * @param _localGasLimit Minimum gas limit for the reverse bridge message on this domain.\n     * @param _remoteGasLimit Minimum gas limit for the bridge message on the other domain.\n     * @param _data Optional data to forward to SL. This data is provided\n     *        solely as a convenience for external contracts. Aside from enforcing a maximum\n     *        length, these contracts provide no guarantees about its content.\n     */\n    function bridgeERC20(\n        address _localToken,\n        address _remoteToken,\n        uint256 _amount,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external payable;\n\n    /**\n     * @dev Initiate a bridge of an amount of ERC20 to a recipient's balance on SL.\n     * @param _localToken Address of the BL ERC20 we are bridging\n     * @param _remoteToken Address of the BL respective SL ERC20\n     * @param _to SL address to credit the ERC20 to.\n     * @param _amount Amount of the ERC20 to bridge.\n     * @param _localGasLimit Minimum gas limit for the reverse bridge message on this domain.\n     * @param _remoteGasLimit Minimum gas limit for the bridge message on the other domain.\n     * @param _data Optional data to forward to SL. This data is provided\n     *        solely as a convenience for external contracts. Aside from enforcing a maximum\n     *        length, these contracts provide no guarantees about its content.\n     */\n    function bridgeERC20To(\n        address _localToken,\n        address _remoteToken,\n        address _to,\n        uint256 _amount,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external payable;\n\n    /*************************\n     * Cross-chain Functions *\n     *************************/\n\n    /**\n     * @dev Finalize a bridge from SL to BL, and credit funds to the recipient's balance of the\n     * BL ERC20 token.\n     * @param _localToken Address of BL token to finalizeBridge for.\n     * @param _remoteToken Address of SL token where bridge was initiated.\n     * @param _from SL address initiating the transfer.\n     * @param _to BL address to credit the ERC20 to.\n     * @param _amount Amount of the ERC20 to bridge.\n     * @param _feeAmount Fee amount in Wei.\n     * @param _localGasLimit Minimum gas limit for the reverse bridge message on this domain.\n     * @param _remoteGasLimit Minimum gas limit for the bridge message on the other domain.\n     * @param _data Data provided by the sender on SL. This data is provided\n     *   solely as a convenience for external contracts. Aside from enforcing a maximum\n     *   length, these contracts provide no guarantees about its content.\n     */\n    function finalizeERC20Bridge(\n        address _localToken,\n        address _remoteToken,\n        address _from,\n        address _to,\n        uint256 _amount,\n        uint256 _feeAmount,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external;\n}\n"
      },
      "contracts/SL/messaging/ISLERC20Bridge.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title ISLERC20Bridge\n */\ninterface ISLERC20Bridge {\n    /**********\n     * Events *\n     **********/\n\n    event BridgeInitiated(\n        address indexed localToken,\n        address indexed remoteToken,\n        address indexed from,\n        address to,\n        uint256 amount,\n        uint256 feeAmount,\n        uint32 localGasLimit,\n        uint32 remoteGasLimit,\n        bytes data\n    );\n\n    event BridgeFinalized(\n        address indexed localToken,\n        address indexed remoteToken,\n        address indexed from,\n        address to,\n        uint256 amount,\n        uint256 feeAmount,\n        uint32 localGasLimit,\n        uint32 remoteGasLimit,\n        bytes data\n    );\n\n    event BridgeFailed(\n        address indexed localToken,\n        address indexed remoteToken,\n        address indexed from,\n        address to,\n        uint256 amount,\n        uint256 feeAmount,\n        uint32 localGasLimit,\n        uint32 remoteGasLimit,\n        bytes data\n    );\n\n    /********************\n     * Public Functions *\n     ********************/\n\n    /**\n     * @dev Get the address of the corresponding BL bridge contract.\n     * @return Address of the corresponding BL bridge contract.\n     */\n    function remoteTokenBridge() external returns (address);\n\n    /**\n     * @dev Initiate a bridge of some tokens to the caller's account on BL.\n     * @param _localToken Address of SL ERC20 we are bridging.\n     * @param _remoteToken Address of the BL respective SL ERC20.\n     * @param _amount Amount of the token to withdraw.\n     * @param _localGasLimit Minimum gas limit for the reverse bridge message on this domain.\n     * @param _remoteGasLimit Minimum gas limit for the bridge message on the other domain.\n     * @param _data Optional data to forward to BL. This data is provided\n     *        solely as a convenience for external contracts. Aside from enforcing a maximum\n     *        length, these contracts provide no guarantees about its content.\n     */\n    function bridge(\n        address _localToken,\n        address _remoteToken,\n        uint256 _amount,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external payable;\n\n    /**\n     * @dev Initiate a bridge of some token to a recipient's account on BL.\n     * @param _localToken Address of SL ERC20 we are bridging.\n     * @param _remoteToken Address of the BL respective SL ERC20.\n     * @param _to BL address to credit the withdrawal to.\n     * @param _amount Amount of the token to withdraw.\n     * @param _localGasLimit Minimum gas limit for the reverse bridge message on this domain.\n     * @param _remoteGasLimit Minimum gas limit for the bridge message on the other domain.\n     * @param _data Optional data to forward to BL. This data is provided\n     *        solely as a convenience for external contracts. Aside from enforcing a maximum\n     *        length, these contracts provide no guarantees about its content.\n     */\n    function bridgeTo(\n        address _localToken,\n        address _remoteToken,\n        address _to,\n        uint256 _amount,\n        uint32 _localGasLimit,\n        uint32 _remoteGasLimit,\n        bytes calldata _data\n    ) external payable;\n\n    /*************************\n     * Cross-chain Functions *\n     *************************/\n\n    /**\n     * @dev Finalize a bridge from BL to SL, and credits funds to the recipient's balance of this\n     * SL token.\n     * @param _remoteToken Address for the bl token this is called with.\n     * @param _localToken Address for the sl token this is called with.\n     * @param _from Account to pull the deposit from on SL.\n     * @param _to Address to receive the withdrawal at.\n     * @param _amount Amount of the token to withdraw.\n     * @param _feeAmount Fee amount in Wei.\n     * @param _remoteGasLimit Minimum gas limit for the bridge message on the other domain.\n     * @param _localGasLimit Minimum gas limit for the reverse bridge message on this domain.\n     * @param _data Data provider by the sender on BL. This data is provided\n     *        solely as a convenience for external contracts. Aside from enforcing a maximum\n     *        length, these contracts provide no guarantees about its content.\n     */\n    function finalizeBridge(\n        address _remoteToken,\n        address _localToken,\n        address _from,\n        address _to,\n        uint256 _amount,\n        uint256 _feeAmount,\n        uint32 _remoteGasLimit,\n        uint32 _localGasLimit,\n        bytes calldata _data\n    ) external;\n}\n"
      },
      "contracts/libraries/constants/Lib_PredeployAddresses.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * @title Lib_PredeployAddresses\n */\nlibrary Lib_PredeployAddresses {\n    address internal constant SL_TO_BL_MESSAGE_PASSER = 0x4200000000000000000000000000000000000000;\n    address internal constant BL_MESSAGE_SENDER = 0x4200000000000000000000000000000000000001;\n    address internal constant DEPLOYER_WHITELIST = 0x4200000000000000000000000000000000000002;\n    address payable internal constant NVM_ETH = payable(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000);\n    address internal constant SL_CROSS_DOMAIN_MESSENGER =\n        0x4200000000000000000000000000000000000007;\n    address internal constant LIB_ADDRESS_MANAGER = 0x4200000000000000000000000000000000000008;\n    address internal constant PROXY_EOA = 0x4200000000000000000000000000000000000009;\n    address internal constant SL_STANDARD_BRIDGE = 0x4200000000000000000000000000000000000010;\n    address internal constant SEQUENCER_FEE_VAULT = 0x4200000000000000000000000000000000000011;\n    address internal constant NAHMII_STANDARD_ERC20_FACTORY =\n        0x4200000000000000000000000000000000000012;\n    address internal constant BL_BLOCK_NUMBER = 0x4200000000000000000000000000000000000013;\n}\n"
      },
      "contracts/libraries/bridge/CrossDomainEnabled.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/* Interface Imports */\nimport { ICrossDomainMessenger } from \"./ICrossDomainMessenger.sol\";\n\n/**\n * @title CrossDomainEnabled\n * @dev Helper contract for contracts performing cross-domain communications\n *\n * Compiler used: defined by inheriting contract\n */\ncontract CrossDomainEnabled {\n    /*************\n     * Variables *\n     *************/\n\n    // Messenger contract used to send and recieve messages from the other domain.\n    address public messenger;\n\n    /***************\n     * Constructor *\n     ***************/\n\n    /**\n     * @param _messenger Address of the CrossDomainMessenger on the current layer.\n     */\n    constructor(address _messenger) {\n        messenger = _messenger;\n    }\n\n    /**********************\n     * Function Modifiers *\n     **********************/\n\n    /**\n     * Enforces that the modified function is only callable by a specific cross-domain account.\n     * @param _sourceDomainAccount The only account on the originating domain which is\n     *  authenticated to call this function.\n     */\n    modifier onlyFromCrossDomainAccount(address _sourceDomainAccount) {\n        require(\n            msg.sender == address(getCrossDomainMessenger()),\n            \"NVM_XCHAIN: messenger contract unauthenticated\"\n        );\n\n        require(\n            getCrossDomainMessenger().xDomainMessageSender() == _sourceDomainAccount,\n            \"NVM_XCHAIN: wrong sender of cross-domain message\"\n        );\n\n        _;\n    }\n\n    /**********************\n     * Internal Functions *\n     **********************/\n\n    /**\n     * Gets the messenger, usually from storage. This function is exposed in case a child contract\n     * needs to override.\n     * @return The address of the cross-domain messenger contract which should be used.\n     */\n    function getCrossDomainMessenger() internal virtual returns (ICrossDomainMessenger) {\n        return ICrossDomainMessenger(messenger);\n    }\n\n    /**q\n     * Sends a message to an account on another domain\n     * @param _crossDomainTarget The intended recipient on the destination domain\n     * @param _message The data to send to the target (usually calldata to a function with\n     *  `onlyFromCrossDomainAccount()`)\n     * @param _gasLimit The gasLimit for the receipt of the message on the target domain.\n     */\n    function sendCrossDomainMessage(\n        address _crossDomainTarget,\n        uint32 _gasLimit,\n        bytes memory _message\n    ) internal {\n        // slither-disable-next-line reentrancy-events, reentrancy-benign\n        getCrossDomainMessenger().sendMessage(_crossDomainTarget, _message, _gasLimit);\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.2) (utils/introspection/ERC165Checker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Library used to query support of an interface declared via {IERC165}.\n *\n * Note that these functions return the actual result of the query: they do not\n * `revert` if an interface is not supported. It is up to the caller to decide\n * what to do in these cases.\n */\nlibrary ERC165Checker {\n    // As per the EIP-165 spec, no interface should ever match 0xffffffff\n    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;\n\n    /**\n     * @dev Returns true if `account` supports the {IERC165} interface.\n     */\n    function supportsERC165(address account) internal view returns (bool) {\n        // Any contract that implements ERC165 must explicitly indicate support of\n        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid\n        return\n            supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&\n            !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);\n    }\n\n    /**\n     * @dev Returns true if `account` supports the interface defined by\n     * `interfaceId`. Support for {IERC165} itself is queried automatically.\n     *\n     * See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {\n        // query support of both ERC165 as per the spec and support of _interfaceId\n        return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);\n    }\n\n    /**\n     * @dev Returns a boolean array where each value corresponds to the\n     * interfaces passed in and whether they're supported or not. This allows\n     * you to batch check interfaces for a contract where your expectation\n     * is that some interfaces may not be supported.\n     *\n     * See {IERC165-supportsInterface}.\n     *\n     * _Available since v3.4._\n     */\n    function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)\n        internal\n        view\n        returns (bool[] memory)\n    {\n        // an array of booleans corresponding to interfaceIds and whether they're supported or not\n        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);\n\n        // query support of ERC165 itself\n        if (supportsERC165(account)) {\n            // query support of each interface in interfaceIds\n            for (uint256 i = 0; i < interfaceIds.length; i++) {\n                interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);\n            }\n        }\n\n        return interfaceIdsSupported;\n    }\n\n    /**\n     * @dev Returns true if `account` supports all the interfaces defined in\n     * `interfaceIds`. Support for {IERC165} itself is queried automatically.\n     *\n     * Batch-querying can lead to gas savings by skipping repeated checks for\n     * {IERC165} support.\n     *\n     * See {IERC165-supportsInterface}.\n     */\n    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {\n        // query support of ERC165 itself\n        if (!supportsERC165(account)) {\n            return false;\n        }\n\n        // query support of each interface in interfaceIds\n        for (uint256 i = 0; i < interfaceIds.length; i++) {\n            if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {\n                return false;\n            }\n        }\n\n        // all interfaces supported\n        return true;\n    }\n\n    /**\n     * @notice Query if a contract implements an interface, does not check ERC165 support\n     * @param account The address of the contract to query for support of an interface\n     * @param interfaceId The interface identifier, as specified in ERC-165\n     * @return true if the contract at account indicates support of the interface with\n     * identifier interfaceId, false otherwise\n     * @dev Assumes that account contains a contract that supports ERC165, otherwise\n     * the behavior of this method is undefined. This precondition can be checked\n     * with {supportsERC165}.\n     *\n     * Some precompiled contracts will falsely indicate support for a given interface, so caution\n     * should be exercised when using this function.\n     *\n     * Interface identification is specified in ERC-165.\n     */\n    function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {\n        // prepare call\n        bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);\n\n        // perform static call\n        bool success;\n        uint256 returnSize;\n        uint256 returnValue;\n        assembly {\n            success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)\n            returnSize := returndatasize()\n            returnValue := mload(0x00)\n        }\n\n        return success && returnSize >= 0x20 && returnValue > 0;\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    function safeTransfer(\n        IERC20 token,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n    }\n\n    function safeTransferFrom(\n        IERC20 token,\n        address from,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    /**\n     * @dev Deprecated. This function has issues similar to the ones found in\n     * {IERC20-approve}, and its usage is discouraged.\n     *\n     * Whenever possible, use {safeIncreaseAllowance} and\n     * {safeDecreaseAllowance} instead.\n     */\n    function safeApprove(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        require(\n            (value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n    }\n\n    function safeIncreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        uint256 newAllowance = token.allowance(address(this), spender) + value;\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n    }\n\n    function safeDecreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        unchecked {\n            uint256 oldAllowance = token.allowance(address(this), spender);\n            require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n            uint256 newAllowance = oldAllowance - value;\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n        }\n    }\n\n    function safePermit(\n        IERC20Permit token,\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal {\n        uint256 nonceBefore = token.nonces(owner);\n        token.permit(owner, spender, value, deadline, v, r, s);\n        uint256 nonceAfter = token.nonces(owner);\n        require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n        if (returndata.length > 0) {\n            // Return data is optional\n            require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "contracts/libraries/bridge/ICrossDomainMessenger.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity >0.5.0 <0.9.0;\n\n/**\n * @title ICrossDomainMessenger\n */\ninterface ICrossDomainMessenger {\n    /**********\n     * Events *\n     **********/\n\n    event SentMessage(\n        address indexed target,\n        address sender,\n        bytes message,\n        uint256 messageNonce,\n        uint256 gasLimit\n    );\n    event RelayedMessage(bytes32 indexed msgHash);\n    event FailedRelayedMessage(bytes32 indexed msgHash);\n\n    /*************\n     * Variables *\n     *************/\n\n    function xDomainMessageSender() external view returns (address);\n\n    /********************\n     * Public Functions *\n     ********************/\n\n    /**\n     * Sends a cross domain message to the target messenger.\n     * @param _target Target contract address.\n     * @param _message Message to send to the target.\n     * @param _gasLimit Gas limit for the provided message.\n     */\n    function sendMessage(\n        address _target,\n        bytes calldata _message,\n        uint32 _gasLimit\n    ) external;\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 10000
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {}
    }
  }}