zellic-audit
Initial commit
f998fcd
raw
history blame
62 kB
{
"language": "Solidity",
"sources": {
"src/bridge/Inbox.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.4;\n\nimport {\n AlreadyInit,\n NotOrigin,\n DataTooLarge,\n AlreadyPaused,\n AlreadyUnpaused,\n Paused,\n InsufficientValue,\n InsufficientSubmissionCost,\n NotAllowedOrigin,\n RetryableData,\n NotRollupOrOwner\n} from \"../libraries/Error.sol\";\nimport \"./IInbox.sol\";\nimport \"./ISequencerInbox.sol\";\nimport \"./IBridge.sol\";\n\nimport \"./Messages.sol\";\nimport \"../libraries/AddressAliasHelper.sol\";\nimport \"../libraries/DelegateCallAware.sol\";\nimport {\n L2_MSG,\n L1MessageType_L2FundedByL1,\n L1MessageType_submitRetryableTx,\n L1MessageType_ethDeposit,\n L2MessageType_unsignedEOATx,\n L2MessageType_unsignedContractTx\n} from \"../libraries/MessageTypes.sol\";\nimport {MAX_DATA_SIZE} from \"../libraries/Constants.sol\";\n\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\n\n/**\n * @title Inbox for user and contract originated messages\n * @notice Messages created via this inbox are enqueued in the delayed accumulator\n * to await inclusion in the SequencerInbox\n */\ncontract Inbox is DelegateCallAware, PausableUpgradeable, IInbox {\n IBridge public bridge;\n ISequencerInbox public sequencerInbox;\n\n /// ------------------------------------ allow list start ------------------------------------ ///\n\n bool public allowListEnabled;\n mapping(address => bool) public isAllowed;\n\n event AllowListAddressSet(address indexed user, bool val);\n event AllowListEnabledUpdated(bool isEnabled);\n\n function setAllowList(address[] memory user, bool[] memory val) external onlyRollupOrOwner {\n require(user.length == val.length, \"INVALID_INPUT\");\n\n for (uint256 i = 0; i < user.length; i++) {\n isAllowed[user[i]] = val[i];\n emit AllowListAddressSet(user[i], val[i]);\n }\n }\n\n function setAllowListEnabled(bool _allowListEnabled) external onlyRollupOrOwner {\n require(_allowListEnabled != allowListEnabled, \"ALREADY_SET\");\n allowListEnabled = _allowListEnabled;\n emit AllowListEnabledUpdated(_allowListEnabled);\n }\n\n /// @dev this modifier checks the tx.origin instead of msg.sender for convenience (ie it allows\n /// allowed users to interact with the token bridge without needing the token bridge to be allowList aware).\n /// this modifier is not intended to use to be used for security (since this opens the allowList to\n /// a smart contract phishing risk).\n modifier onlyAllowed() {\n // solhint-disable-next-line avoid-tx-origin\n if (allowListEnabled && !isAllowed[tx.origin]) revert NotAllowedOrigin(tx.origin);\n _;\n }\n\n /// ------------------------------------ allow list end ------------------------------------ ///\n\n modifier onlyRollupOrOwner() {\n IOwnable rollup = bridge.rollup();\n if (msg.sender != address(rollup)) {\n address rollupOwner = rollup.owner();\n if (msg.sender != rollupOwner) {\n revert NotRollupOrOwner(msg.sender, address(rollup), rollupOwner);\n }\n }\n _;\n }\n\n /// @inheritdoc IInbox\n function pause() external onlyRollupOrOwner {\n _pause();\n }\n\n /// @inheritdoc IInbox\n function unpause() external onlyRollupOrOwner {\n _unpause();\n }\n\n function initialize(IBridge _bridge, ISequencerInbox _sequencerInbox)\n external\n initializer\n onlyDelegated\n {\n bridge = _bridge;\n sequencerInbox = _sequencerInbox;\n allowListEnabled = false;\n __Pausable_init();\n }\n\n /// @inheritdoc IInbox\n function postUpgradeInit(IBridge _bridge) external onlyDelegated onlyProxyOwner {\n uint8 slotsToWipe = 3;\n for (uint8 i = 0; i < slotsToWipe; i++) {\n assembly {\n sstore(i, 0)\n }\n }\n allowListEnabled = false;\n bridge = _bridge;\n }\n\n /// @inheritdoc IInbox\n function sendL2MessageFromOrigin(bytes calldata messageData)\n external\n whenNotPaused\n onlyAllowed\n returns (uint256)\n {\n // solhint-disable-next-line avoid-tx-origin\n if (msg.sender != tx.origin) revert NotOrigin();\n if (messageData.length > MAX_DATA_SIZE)\n revert DataTooLarge(messageData.length, MAX_DATA_SIZE);\n uint256 msgNum = deliverToBridge(L2_MSG, msg.sender, keccak256(messageData));\n emit InboxMessageDeliveredFromOrigin(msgNum);\n return msgNum;\n }\n\n /// @inheritdoc IInbox\n function sendL2Message(bytes calldata messageData)\n external\n whenNotPaused\n onlyAllowed\n returns (uint256)\n {\n return _deliverMessage(L2_MSG, msg.sender, messageData);\n }\n\n function sendL1FundedUnsignedTransaction(\n uint256 gasLimit,\n uint256 maxFeePerGas,\n uint256 nonce,\n address to,\n bytes calldata data\n ) external payable whenNotPaused onlyAllowed returns (uint256) {\n return\n _deliverMessage(\n L1MessageType_L2FundedByL1,\n msg.sender,\n abi.encodePacked(\n L2MessageType_unsignedEOATx,\n gasLimit,\n maxFeePerGas,\n nonce,\n uint256(uint160(to)),\n msg.value,\n data\n )\n );\n }\n\n function sendL1FundedContractTransaction(\n uint256 gasLimit,\n uint256 maxFeePerGas,\n address to,\n bytes calldata data\n ) external payable whenNotPaused onlyAllowed returns (uint256) {\n return\n _deliverMessage(\n L1MessageType_L2FundedByL1,\n msg.sender,\n abi.encodePacked(\n L2MessageType_unsignedContractTx,\n gasLimit,\n maxFeePerGas,\n uint256(uint160(to)),\n msg.value,\n data\n )\n );\n }\n\n function sendUnsignedTransaction(\n uint256 gasLimit,\n uint256 maxFeePerGas,\n uint256 nonce,\n address to,\n uint256 value,\n bytes calldata data\n ) external whenNotPaused onlyAllowed returns (uint256) {\n return\n _deliverMessage(\n L2_MSG,\n msg.sender,\n abi.encodePacked(\n L2MessageType_unsignedEOATx,\n gasLimit,\n maxFeePerGas,\n nonce,\n uint256(uint160(to)),\n value,\n data\n )\n );\n }\n\n function sendContractTransaction(\n uint256 gasLimit,\n uint256 maxFeePerGas,\n address to,\n uint256 value,\n bytes calldata data\n ) external whenNotPaused onlyAllowed returns (uint256) {\n return\n _deliverMessage(\n L2_MSG,\n msg.sender,\n abi.encodePacked(\n L2MessageType_unsignedContractTx,\n gasLimit,\n maxFeePerGas,\n uint256(uint160(to)),\n value,\n data\n )\n );\n }\n\n /// @inheritdoc IInbox\n function calculateRetryableSubmissionFee(uint256 dataLength, uint256 baseFee)\n public\n view\n returns (uint256)\n {\n // Use current block basefee if baseFee parameter is 0\n return (1400 + 6 * dataLength) * (baseFee == 0 ? block.basefee : baseFee);\n }\n\n /// @inheritdoc IInbox\n function depositEth() public payable whenNotPaused onlyAllowed returns (uint256) {\n address dest = msg.sender;\n\n // solhint-disable-next-line avoid-tx-origin\n if (AddressUpgradeable.isContract(msg.sender) || tx.origin != msg.sender) {\n // isContract check fails if this function is called during a contract's constructor.\n dest = AddressAliasHelper.applyL1ToL2Alias(msg.sender);\n }\n\n return\n _deliverMessage(\n L1MessageType_ethDeposit,\n msg.sender,\n abi.encodePacked(dest, msg.value)\n );\n }\n\n /// @notice deprecated in favour of depositEth with no parameters\n function depositEth(uint256) external payable whenNotPaused onlyAllowed returns (uint256) {\n return depositEth();\n }\n\n /**\n * @notice deprecated in favour of unsafeCreateRetryableTicket\n * @dev deprecated in favour of unsafeCreateRetryableTicket\n * @dev Gas limit and maxFeePerGas should not be set to 1 as that is used to trigger the RetryableData error\n * @param to destination L2 contract address\n * @param l2CallValue call value for retryable L2 message\n * @param maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee\n * @param excessFeeRefundAddress gasLimit x maxFeePerGas - execution cost gets credited here on L2 balance\n * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n * @param gasLimit Max gas deducted from user's L2 balance to cover L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)\n * @param maxFeePerGas price bid for L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)\n * @param data ABI encoded data of L2 message\n * @return unique message number of the retryable transaction\n */\n function createRetryableTicketNoRefundAliasRewrite(\n address to,\n uint256 l2CallValue,\n uint256 maxSubmissionCost,\n address excessFeeRefundAddress,\n address callValueRefundAddress,\n uint256 gasLimit,\n uint256 maxFeePerGas,\n bytes calldata data\n ) external payable whenNotPaused onlyAllowed returns (uint256) {\n return\n unsafeCreateRetryableTicket(\n to,\n l2CallValue,\n maxSubmissionCost,\n excessFeeRefundAddress,\n callValueRefundAddress,\n gasLimit,\n maxFeePerGas,\n data\n );\n }\n\n /// @inheritdoc IInbox\n function createRetryableTicket(\n address to,\n uint256 l2CallValue,\n uint256 maxSubmissionCost,\n address excessFeeRefundAddress,\n address callValueRefundAddress,\n uint256 gasLimit,\n uint256 maxFeePerGas,\n bytes calldata data\n ) external payable whenNotPaused onlyAllowed returns (uint256) {\n // ensure the user's deposit alone will make submission succeed\n if (msg.value < (maxSubmissionCost + l2CallValue + gasLimit * maxFeePerGas)) {\n revert InsufficientValue(\n maxSubmissionCost + l2CallValue + gasLimit * maxFeePerGas,\n msg.value\n );\n }\n\n // if a refund address is a contract, we apply the alias to it\n // so that it can access its funds on the L2\n // since the beneficiary and other refund addresses don't get rewritten by arb-os\n if (AddressUpgradeable.isContract(excessFeeRefundAddress)) {\n excessFeeRefundAddress = AddressAliasHelper.applyL1ToL2Alias(excessFeeRefundAddress);\n }\n if (AddressUpgradeable.isContract(callValueRefundAddress)) {\n // this is the beneficiary. be careful since this is the address that can cancel the retryable in the L2\n callValueRefundAddress = AddressAliasHelper.applyL1ToL2Alias(callValueRefundAddress);\n }\n\n return\n unsafeCreateRetryableTicket(\n to,\n l2CallValue,\n maxSubmissionCost,\n excessFeeRefundAddress,\n callValueRefundAddress,\n gasLimit,\n maxFeePerGas,\n data\n );\n }\n\n /// @inheritdoc IInbox\n function unsafeCreateRetryableTicket(\n address to,\n uint256 l2CallValue,\n uint256 maxSubmissionCost,\n address excessFeeRefundAddress,\n address callValueRefundAddress,\n uint256 gasLimit,\n uint256 maxFeePerGas,\n bytes calldata data\n ) public payable whenNotPaused onlyAllowed returns (uint256) {\n // gas price and limit of 1 should never be a valid input, so instead they are used as\n // magic values to trigger a revert in eth calls that surface data without requiring a tx trace\n if (gasLimit == 1 || maxFeePerGas == 1)\n revert RetryableData(\n msg.sender,\n to,\n l2CallValue,\n msg.value,\n maxSubmissionCost,\n excessFeeRefundAddress,\n callValueRefundAddress,\n gasLimit,\n maxFeePerGas,\n data\n );\n\n uint256 submissionFee = calculateRetryableSubmissionFee(data.length, block.basefee);\n if (maxSubmissionCost < submissionFee)\n revert InsufficientSubmissionCost(submissionFee, maxSubmissionCost);\n\n return\n _deliverMessage(\n L1MessageType_submitRetryableTx,\n msg.sender,\n abi.encodePacked(\n uint256(uint160(to)),\n l2CallValue,\n msg.value,\n maxSubmissionCost,\n uint256(uint160(excessFeeRefundAddress)),\n uint256(uint160(callValueRefundAddress)),\n gasLimit,\n maxFeePerGas,\n data.length,\n data\n )\n );\n }\n\n function _deliverMessage(\n uint8 _kind,\n address _sender,\n bytes memory _messageData\n ) internal returns (uint256) {\n if (_messageData.length > MAX_DATA_SIZE)\n revert DataTooLarge(_messageData.length, MAX_DATA_SIZE);\n uint256 msgNum = deliverToBridge(_kind, _sender, keccak256(_messageData));\n emit InboxMessageDelivered(msgNum, _messageData);\n return msgNum;\n }\n\n function deliverToBridge(\n uint8 kind,\n address sender,\n bytes32 messageDataHash\n ) internal returns (uint256) {\n return\n bridge.enqueueDelayedMessage{value: msg.value}(\n kind,\n AddressAliasHelper.applyL1ToL2Alias(sender),\n messageDataHash\n );\n }\n}\n"
},
"src/libraries/Error.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.4;\n\n/// @dev Init was already called\nerror AlreadyInit();\n\n/// Init was called with param set to zero that must be nonzero\nerror HadZeroInit();\n\n/// @dev Thrown when non owner tries to access an only-owner function\n/// @param sender The msg.sender who is not the owner\n/// @param owner The owner address\nerror NotOwner(address sender, address owner);\n\n/// @dev Thrown when an address that is not the rollup tries to call an only-rollup function\n/// @param sender The sender who is not the rollup\n/// @param rollup The rollup address authorized to call this function\nerror NotRollup(address sender, address rollup);\n\n/// @dev Thrown when the contract was not called directly from the origin ie msg.sender != tx.origin\nerror NotOrigin();\n\n/// @dev Provided data was too large\n/// @param dataLength The length of the data that is too large\n/// @param maxDataLength The max length the data can be\nerror DataTooLarge(uint256 dataLength, uint256 maxDataLength);\n\n/// @dev The provided is not a contract and was expected to be\n/// @param addr The adddress in question\nerror NotContract(address addr);\n\n/// @dev The merkle proof provided was too long\n/// @param actualLength The length of the merkle proof provided\n/// @param maxProofLength The max length a merkle proof can have\nerror MerkleProofTooLong(uint256 actualLength, uint256 maxProofLength);\n\n/// @dev Thrown when an un-authorized address tries to access an admin function\n/// @param sender The un-authorized sender\n/// @param rollup The rollup, which would be authorized\n/// @param owner The rollup's owner, which would be authorized\nerror NotRollupOrOwner(address sender, address rollup, address owner);\n\n// Bridge Errors\n\n/// @dev Thrown when an un-authorized address tries to access an only-inbox function\n/// @param sender The un-authorized sender\nerror NotDelayedInbox(address sender);\n\n/// @dev Thrown when an un-authorized address tries to access an only-sequencer-inbox function\n/// @param sender The un-authorized sender\nerror NotSequencerInbox(address sender);\n\n/// @dev Thrown when an un-authorized address tries to access an only-outbox function\n/// @param sender The un-authorized sender\nerror NotOutbox(address sender);\n\n/// @dev the provided outbox address isn't valid\n/// @param outbox address of outbox being set\nerror InvalidOutboxSet(address outbox);\n\n// Inbox Errors\n\n/// @dev The contract is paused, so cannot be paused\nerror AlreadyPaused();\n\n/// @dev The contract is unpaused, so cannot be unpaused\nerror AlreadyUnpaused();\n\n/// @dev The contract is paused\nerror Paused();\n\n/// @dev msg.value sent to the inbox isn't high enough\nerror InsufficientValue(uint256 expected, uint256 actual);\n\n/// @dev submission cost provided isn't enough to create retryable ticket\nerror InsufficientSubmissionCost(uint256 expected, uint256 actual);\n\n/// @dev address not allowed to interact with the given contract\nerror NotAllowedOrigin(address origin);\n\n/// @dev used to convey retryable tx data in eth calls without requiring a tx trace\n/// this follows a pattern similar to EIP-3668 where reverts surface call information\nerror RetryableData(\n address from,\n address to,\n uint256 l2CallValue,\n uint256 deposit,\n uint256 maxSubmissionCost,\n address excessFeeRefundAddress,\n address callValueRefundAddress,\n uint256 gasLimit,\n uint256 maxFeePerGas,\n bytes data\n);\n\n// Outbox Errors\n\n/// @dev The provided proof was too long\n/// @param proofLength The length of the too-long proof\nerror ProofTooLong(uint256 proofLength);\n\n/// @dev The output index was greater than the maximum\n/// @param index The output index\n/// @param maxIndex The max the index could be\nerror PathNotMinimal(uint256 index, uint256 maxIndex);\n\n/// @dev The calculated root does not exist\n/// @param root The calculated root\nerror UnknownRoot(bytes32 root);\n\n/// @dev The record has already been spent\n/// @param index The index of the spent record\nerror AlreadySpent(uint256 index);\n\n/// @dev A call to the bridge failed with no return data\nerror BridgeCallFailed();\n\n// Sequencer Inbox Errors\n\n/// @dev Thrown when someone attempts to read fewer messages than have already been read\nerror DelayedBackwards();\n\n/// @dev Thrown when someone attempts to read more messages than exist\nerror DelayedTooFar();\n\n/// @dev Force include can only read messages more blocks old than the delay period\nerror ForceIncludeBlockTooSoon();\n\n/// @dev Force include can only read messages more seconds old than the delay period\nerror ForceIncludeTimeTooSoon();\n\n/// @dev The message provided did not match the hash in the delayed inbox\nerror IncorrectMessagePreimage();\n\n/// @dev This can only be called by the batch poster\nerror NotBatchPoster();\n\n/// @dev The sequence number provided to this message was inconsistent with the number of batches already included\nerror BadSequencerNumber(uint256 stored, uint256 received);\n\n/// @dev The batch data has the inbox authenticated bit set, but the batch data was not authenticated by the inbox\nerror DataNotAuthenticated();\n\n/// @dev Tried to create an already valid Data Availability Service keyset\nerror AlreadyValidDASKeyset(bytes32);\n\n/// @dev Tried to use or invalidate an already invalid Data Availability Service keyset\nerror NoSuchKeyset(bytes32);\n"
},
"src/bridge/IInbox.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\n// solhint-disable-next-line compiler-version\npragma solidity >=0.6.9 <0.9.0;\n\nimport \"./IBridge.sol\";\nimport \"./IDelayedMessageProvider.sol\";\nimport \"./ISequencerInbox.sol\";\n\ninterface IInbox is IDelayedMessageProvider {\n function bridge() external view returns (IBridge);\n\n function sequencerInbox() external view returns (ISequencerInbox);\n\n /**\n * @notice Send a generic L2 message to the chain\n * @dev This method is an optimization to avoid having to emit the entirety of the messageData in a log. Instead validators are expected to be able to parse the data from the transaction's input\n * @param messageData Data of the message being sent\n */\n function sendL2MessageFromOrigin(bytes calldata messageData) external returns (uint256);\n\n /**\n * @notice Send a generic L2 message to the chain\n * @dev This method can be used to send any type of message that doesn't require L1 validation\n * @param messageData Data of the message being sent\n */\n function sendL2Message(bytes calldata messageData) external returns (uint256);\n\n function sendL1FundedUnsignedTransaction(\n uint256 gasLimit,\n uint256 maxFeePerGas,\n uint256 nonce,\n address to,\n bytes calldata data\n ) external payable returns (uint256);\n\n function sendL1FundedContractTransaction(\n uint256 gasLimit,\n uint256 maxFeePerGas,\n address to,\n bytes calldata data\n ) external payable returns (uint256);\n\n function sendUnsignedTransaction(\n uint256 gasLimit,\n uint256 maxFeePerGas,\n uint256 nonce,\n address to,\n uint256 value,\n bytes calldata data\n ) external returns (uint256);\n\n function sendContractTransaction(\n uint256 gasLimit,\n uint256 maxFeePerGas,\n address to,\n uint256 value,\n bytes calldata data\n ) external returns (uint256);\n\n /**\n * @notice Get the L1 fee for submitting a retryable\n * @dev This fee can be paid by funds already in the L2 aliased address or by the current message value\n * @dev This formula may change in the future, to future proof your code query this method instead of inlining!!\n * @param dataLength The length of the retryable's calldata, in bytes\n * @param baseFee The block basefee when the retryable is included in the chain, if 0 current block.basefee will be used\n */\n function calculateRetryableSubmissionFee(uint256 dataLength, uint256 baseFee)\n external\n view\n returns (uint256);\n\n /**\n * @notice Deposit eth from L1 to L2 to address of the sender if sender is an EOA, and to its aliased address if the sender is a contract\n * @dev This does not trigger the fallback function when receiving in the L2 side.\n * Look into retryable tickets if you are interested in this functionality.\n * @dev This function should not be called inside contract constructors\n */\n function depositEth() external payable returns (uint256);\n\n /**\n * @notice Put a message in the L2 inbox that can be reexecuted for some fixed amount of time if it reverts\n * @dev all msg.value will deposited to callValueRefundAddress on L2\n * @dev Gas limit and maxFeePerGas should not be set to 1 as that is used to trigger the RetryableData error\n * @param to destination L2 contract address\n * @param l2CallValue call value for retryable L2 message\n * @param maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee\n * @param excessFeeRefundAddress gasLimit x maxFeePerGas - execution cost gets credited here on L2 balance\n * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n * @param gasLimit Max gas deducted from user's L2 balance to cover L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)\n * @param maxFeePerGas price bid for L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)\n * @param data ABI encoded data of L2 message\n * @return unique message number of the retryable transaction\n */\n function createRetryableTicket(\n address to,\n uint256 l2CallValue,\n uint256 maxSubmissionCost,\n address excessFeeRefundAddress,\n address callValueRefundAddress,\n uint256 gasLimit,\n uint256 maxFeePerGas,\n bytes calldata data\n ) external payable returns (uint256);\n\n /**\n * @notice Put a message in the L2 inbox that can be reexecuted for some fixed amount of time if it reverts\n * @dev Same as createRetryableTicket, but does not guarantee that submission will succeed by requiring the needed funds\n * come from the deposit alone, rather than falling back on the user's L2 balance\n * @dev Advanced usage only (does not rewrite aliases for excessFeeRefundAddress and callValueRefundAddress).\n * createRetryableTicket method is the recommended standard.\n * @dev Gas limit and maxFeePerGas should not be set to 1 as that is used to trigger the RetryableData error\n * @param to destination L2 contract address\n * @param l2CallValue call value for retryable L2 message\n * @param maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee\n * @param excessFeeRefundAddress gasLimit x maxFeePerGas - execution cost gets credited here on L2 balance\n * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled\n * @param gasLimit Max gas deducted from user's L2 balance to cover L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)\n * @param maxFeePerGas price bid for L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)\n * @param data ABI encoded data of L2 message\n * @return unique message number of the retryable transaction\n */\n function unsafeCreateRetryableTicket(\n address to,\n uint256 l2CallValue,\n uint256 maxSubmissionCost,\n address excessFeeRefundAddress,\n address callValueRefundAddress,\n uint256 gasLimit,\n uint256 maxFeePerGas,\n bytes calldata data\n ) external payable returns (uint256);\n\n // ---------- onlyRollupOrOwner functions ----------\n\n /// @notice pauses all inbox functionality\n function pause() external;\n\n /// @notice unpauses all inbox functionality\n function unpause() external;\n\n // ---------- initializer ----------\n\n /**\n * @dev function to be called one time during the inbox upgrade process\n * this is used to fix the storage slots\n */\n function postUpgradeInit(IBridge _bridge) external;\n\n function initialize(IBridge _bridge, ISequencerInbox _sequencerInbox) external;\n}\n"
},
"src/bridge/ISequencerInbox.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\n// solhint-disable-next-line compiler-version\npragma solidity >=0.6.9 <0.9.0;\npragma experimental ABIEncoderV2;\n\nimport \"../libraries/IGasRefunder.sol\";\nimport \"./IDelayedMessageProvider.sol\";\nimport \"./IBridge.sol\";\n\ninterface ISequencerInbox is IDelayedMessageProvider {\n struct MaxTimeVariation {\n uint256 delayBlocks;\n uint256 futureBlocks;\n uint256 delaySeconds;\n uint256 futureSeconds;\n }\n\n struct TimeBounds {\n uint64 minTimestamp;\n uint64 maxTimestamp;\n uint64 minBlockNumber;\n uint64 maxBlockNumber;\n }\n\n enum BatchDataLocation {\n TxInput,\n SeparateBatchEvent,\n NoData\n }\n\n event SequencerBatchDelivered(\n uint256 indexed batchSequenceNumber,\n bytes32 indexed beforeAcc,\n bytes32 indexed afterAcc,\n bytes32 delayedAcc,\n uint256 afterDelayedMessagesRead,\n TimeBounds timeBounds,\n BatchDataLocation dataLocation\n );\n\n event OwnerFunctionCalled(uint256 indexed id);\n\n /// @dev a separate event that emits batch data when this isn't easily accessible in the tx.input\n event SequencerBatchData(uint256 indexed batchSequenceNumber, bytes data);\n\n /// @dev a valid keyset was added\n event SetValidKeyset(bytes32 indexed keysetHash, bytes keysetBytes);\n\n /// @dev a keyset was invalidated\n event InvalidateKeyset(bytes32 indexed keysetHash);\n\n function totalDelayedMessagesRead() external view returns (uint256);\n\n function bridge() external view returns (IBridge);\n\n /// @dev The size of the batch header\n // solhint-disable-next-line func-name-mixedcase\n function HEADER_LENGTH() external view returns (uint256);\n\n /// @dev If the first batch data byte after the header has this bit set,\n /// the sequencer inbox has authenticated the data. Currently not used.\n // solhint-disable-next-line func-name-mixedcase\n function DATA_AUTHENTICATED_FLAG() external view returns (bytes1);\n\n function rollup() external view returns (IOwnable);\n\n function isBatchPoster(address) external view returns (bool);\n\n struct DasKeySetInfo {\n bool isValidKeyset;\n uint64 creationBlock;\n }\n\n // https://github.com/ethereum/solidity/issues/11826\n // function maxTimeVariation() external view returns (MaxTimeVariation calldata);\n // function dasKeySetInfo(bytes32) external view returns (DasKeySetInfo calldata);\n\n /// @notice Force messages from the delayed inbox to be included in the chain\n /// Callable by any address, but message can only be force-included after maxTimeVariation.delayBlocks and\n /// maxTimeVariation.delaySeconds has elapsed. As part of normal behaviour the sequencer will include these\n /// messages so it's only necessary to call this if the sequencer is down, or not including any delayed messages.\n /// @param _totalDelayedMessagesRead The total number of messages to read up to\n /// @param kind The kind of the last message to be included\n /// @param l1BlockAndTime The l1 block and the l1 timestamp of the last message to be included\n /// @param baseFeeL1 The l1 gas price of the last message to be included\n /// @param sender The sender of the last message to be included\n /// @param messageDataHash The messageDataHash of the last message to be included\n function forceInclusion(\n uint256 _totalDelayedMessagesRead,\n uint8 kind,\n uint64[2] calldata l1BlockAndTime,\n uint256 baseFeeL1,\n address sender,\n bytes32 messageDataHash\n ) external;\n\n function inboxAccs(uint256 index) external view returns (bytes32);\n\n function batchCount() external view returns (uint256);\n\n function isValidKeysetHash(bytes32 ksHash) external view returns (bool);\n\n /// @notice the creation block is intended to still be available after a keyset is deleted\n function getKeysetCreationBlock(bytes32 ksHash) external view returns (uint256);\n\n // ---------- BatchPoster functions ----------\n\n function addSequencerL2BatchFromOrigin(\n uint256 sequenceNumber,\n bytes calldata data,\n uint256 afterDelayedMessagesRead,\n IGasRefunder gasRefunder\n ) external;\n\n function addSequencerL2Batch(\n uint256 sequenceNumber,\n bytes calldata data,\n uint256 afterDelayedMessagesRead,\n IGasRefunder gasRefunder\n ) external;\n\n // ---------- onlyRollupOrOwner functions ----------\n\n /**\n * @notice Set max delay for sequencer inbox\n * @param maxTimeVariation_ the maximum time variation parameters\n */\n function setMaxTimeVariation(MaxTimeVariation memory maxTimeVariation_) external;\n\n /**\n * @notice Updates whether an address is authorized to be a batch poster at the sequencer inbox\n * @param addr the address\n * @param isBatchPoster_ if the specified address should be authorized as a batch poster\n */\n function setIsBatchPoster(address addr, bool isBatchPoster_) external;\n\n /**\n * @notice Makes Data Availability Service keyset valid\n * @param keysetBytes bytes of the serialized keyset\n */\n function setValidKeyset(bytes calldata keysetBytes) external;\n\n /**\n * @notice Invalidates a Data Availability Service keyset\n * @param ksHash hash of the keyset\n */\n function invalidateKeysetHash(bytes32 ksHash) external;\n\n // ---------- initializer ----------\n\n function initialize(IBridge bridge_, MaxTimeVariation calldata maxTimeVariation_) external;\n}\n"
},
"src/bridge/IBridge.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\n// solhint-disable-next-line compiler-version\npragma solidity >=0.6.9 <0.9.0;\n\nimport \"./IOwnable.sol\";\n\ninterface IBridge {\n event MessageDelivered(\n uint256 indexed messageIndex,\n bytes32 indexed beforeInboxAcc,\n address inbox,\n uint8 kind,\n address sender,\n bytes32 messageDataHash,\n uint256 baseFeeL1,\n uint64 timestamp\n );\n\n event BridgeCallTriggered(\n address indexed outbox,\n address indexed to,\n uint256 value,\n bytes data\n );\n\n event InboxToggle(address indexed inbox, bool enabled);\n\n event OutboxToggle(address indexed outbox, bool enabled);\n\n event SequencerInboxUpdated(address newSequencerInbox);\n\n function allowedDelayedInboxList(uint256) external returns (address);\n\n function allowedOutboxList(uint256) external returns (address);\n\n /// @dev Accumulator for delayed inbox messages; tail represents hash of the current state; each element represents the inclusion of a new message.\n function delayedInboxAccs(uint256) external view returns (bytes32);\n\n /// @dev Accumulator for sequencer inbox messages; tail represents hash of the current state; each element represents the inclusion of a new message.\n function sequencerInboxAccs(uint256) external view returns (bytes32);\n\n function rollup() external view returns (IOwnable);\n\n function sequencerInbox() external view returns (address);\n\n function activeOutbox() external view returns (address);\n\n function allowedDelayedInboxes(address inbox) external view returns (bool);\n\n function allowedOutboxes(address outbox) external view returns (bool);\n\n /**\n * @dev Enqueue a message in the delayed inbox accumulator.\n * These messages are later sequenced in the SequencerInbox, either\n * by the sequencer as part of a normal batch, or by force inclusion.\n */\n function enqueueDelayedMessage(\n uint8 kind,\n address sender,\n bytes32 messageDataHash\n ) external payable returns (uint256);\n\n function executeCall(\n address to,\n uint256 value,\n bytes calldata data\n ) external returns (bool success, bytes memory returnData);\n\n function delayedMessageCount() external view returns (uint256);\n\n function sequencerMessageCount() external view returns (uint256);\n\n // ---------- onlySequencerInbox functions ----------\n\n function enqueueSequencerMessage(bytes32 dataHash, uint256 afterDelayedMessagesRead)\n external\n returns (\n uint256 seqMessageIndex,\n bytes32 beforeAcc,\n bytes32 delayedAcc,\n bytes32 acc\n );\n\n /**\n * @dev Allows the sequencer inbox to submit a delayed message of the batchPostingReport type\n * This is done through a separate function entrypoint instead of allowing the sequencer inbox\n * to call `enqueueDelayedMessage` to avoid the gas overhead of an extra SLOAD in either\n * every delayed inbox or every sequencer inbox call.\n */\n function submitBatchSpendingReport(address batchPoster, bytes32 dataHash)\n external\n returns (uint256 msgNum);\n\n // ---------- onlyRollupOrOwner functions ----------\n\n function setSequencerInbox(address _sequencerInbox) external;\n\n function setDelayedInbox(address inbox, bool enabled) external;\n\n function setOutbox(address inbox, bool enabled) external;\n\n // ---------- initializer ----------\n\n function initialize(IOwnable rollup_) external;\n}\n"
},
"src/bridge/Messages.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.0;\n\nlibrary Messages {\n function messageHash(\n uint8 kind,\n address sender,\n uint64 blockNumber,\n uint64 timestamp,\n uint256 inboxSeqNum,\n uint256 baseFeeL1,\n bytes32 messageDataHash\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(\n kind,\n sender,\n blockNumber,\n timestamp,\n inboxSeqNum,\n baseFeeL1,\n messageDataHash\n )\n );\n }\n\n function accumulateInboxMessage(bytes32 prevAcc, bytes32 message)\n internal\n pure\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(prevAcc, message));\n }\n}\n"
},
"src/libraries/AddressAliasHelper.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.0;\n\nlibrary AddressAliasHelper {\n uint160 internal constant OFFSET = uint160(0x1111000000000000000000000000000000001111);\n\n /// @notice Utility function that converts the address in the L1 that submitted a tx to\n /// the inbox to the msg.sender viewed in the L2\n /// @param l1Address the address in the L1 that triggered the tx to L2\n /// @return l2Address L2 address as viewed in msg.sender\n function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\n unchecked {\n l2Address = address(uint160(l1Address) + OFFSET);\n }\n }\n\n /// @notice Utility function that converts the msg.sender viewed in the L2 to the\n /// address in the L1 that submitted a tx to the inbox\n /// @param l2Address L2 address as viewed in msg.sender\n /// @return l1Address the address in the L1 that triggered the tx to L2\n function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) {\n unchecked {\n l1Address = address(uint160(l2Address) - OFFSET);\n }\n }\n}\n"
},
"src/libraries/DelegateCallAware.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.0;\n\nimport {NotOwner} from \"./Error.sol\";\n\n/// @dev A stateless contract that allows you to infer if the current call has been delegated or not\n/// Pattern used here is from UUPS implementation by the OpenZeppelin team\nabstract contract DelegateCallAware {\n address private immutable __self = address(this);\n\n /**\n * @dev Check that the execution is being performed through a delegate call. This allows a function to be\n * callable on the proxy contract but not on the logic contract.\n */\n modifier onlyDelegated() {\n require(address(this) != __self, \"Function must be called through delegatecall\");\n _;\n }\n\n /**\n * @dev Check that the execution is not being performed through a delegate call. This allows a function to be\n * callable on the implementing contract but not through proxies.\n */\n modifier notDelegated() {\n require(address(this) == __self, \"Function must not be called through delegatecall\");\n _;\n }\n\n /// @dev Check that msg.sender is the current EIP 1967 proxy admin\n modifier onlyProxyOwner() {\n // Storage slot with the admin of the proxy contract\n // This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1\n bytes32 slot = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n address admin;\n assembly {\n admin := sload(slot)\n }\n if (msg.sender != admin) revert NotOwner(msg.sender, admin);\n _;\n }\n}\n"
},
"src/libraries/MessageTypes.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.4;\n\nuint8 constant L2_MSG = 3;\nuint8 constant L1MessageType_L2FundedByL1 = 7;\nuint8 constant L1MessageType_submitRetryableTx = 9;\nuint8 constant L1MessageType_ethDeposit = 12;\nuint8 constant L1MessageType_batchPostingReport = 13;\nuint8 constant L2MessageType_unsignedEOATx = 0;\nuint8 constant L2MessageType_unsignedContractTx = 1;\n\nuint8 constant ROLLUP_PROTOCOL_EVENT_TYPE = 8;\nuint8 constant INITIALIZATION_MSG_TYPE = 11;\n"
},
"src/libraries/Constants.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.4;\n\n// 90% of Geth's 128KB tx size limit, leaving ~13KB for proving\nuint256 constant MAX_DATA_SIZE = 117964;\n\nuint64 constant NO_CHAL_INDEX = 0;\n"
},
"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"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 require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(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 require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason 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 // 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\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}\n"
},
"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n require(!paused(), \"Pausable: paused\");\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n require(paused(), \"Pausable: not paused\");\n _;\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n"
},
"src/bridge/IDelayedMessageProvider.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\n// solhint-disable-next-line compiler-version\npragma solidity >=0.6.9 <0.9.0;\n\ninterface IDelayedMessageProvider {\n /// @dev event emitted when a inbox message is added to the Bridge's delayed accumulator\n event InboxMessageDelivered(uint256 indexed messageNum, bytes data);\n\n /// @dev event emitted when a inbox message is added to the Bridge's delayed accumulator\n /// same as InboxMessageDelivered but the batch data is available in tx.input\n event InboxMessageDeliveredFromOrigin(uint256 indexed messageNum);\n}\n"
},
"src/bridge/IOwnable.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\n// solhint-disable-next-line compiler-version\npragma solidity >=0.4.21 <0.9.0;\n\ninterface IOwnable {\n function owner() external view returns (address);\n}\n"
},
"src/libraries/IGasRefunder.sol": {
"content": "// Copyright 2021-2022, Offchain Labs, Inc.\n// For license information, see https://github.com/nitro/blob/master/LICENSE\n// SPDX-License-Identifier: BUSL-1.1\n\n// solhint-disable-next-line compiler-version\npragma solidity >=0.6.9 <0.9.0;\n\ninterface IGasRefunder {\n function onGasSpent(\n address payable spender,\n uint256 gasUsed,\n uint256 calldataSize\n ) external returns (bool success);\n}\n\nabstract contract GasRefundEnabled {\n /// @dev this refunds the sender for execution costs of the tx\n /// calldata costs are only refunded if `msg.sender == tx.origin` to guarantee the value refunded relates to charging\n /// for the `tx.input`. this avoids a possible attack where you generate large calldata from a contract and get over-refunded\n modifier refundsGas(IGasRefunder gasRefunder) {\n uint256 startGasLeft = gasleft();\n _;\n if (address(gasRefunder) != address(0)) {\n uint256 calldataSize = 0;\n // if triggered in a contract call, the spender may be overrefunded by appending dummy data to the call\n // so we check if it is a top level call, which would mean the sender paid calldata as part of tx.input\n // solhint-disable-next-line avoid-tx-origin\n if (msg.sender == tx.origin) {\n assembly {\n calldataSize := calldatasize()\n }\n }\n gasRefunder.onGasSpent(payable(msg.sender), startGasLeft - gasleft(), calldataSize);\n }\n }\n}\n"
},
"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n"
},
"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() initializer {}\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n // If the contract is initializing we ignore whether _initialized is set in order to support multiple\n // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\n // contract may have been reentered.\n require(_initializing ? _isConstructor() : !_initialized, \"Initializable: contract is already initialized\");\n\n bool isTopLevelCall = !_initializing;\n if (isTopLevelCall) {\n _initializing = true;\n _initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n }\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} modifier, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n function _isConstructor() private view returns (bool) {\n return !AddressUpgradeable.isContract(address(this));\n }\n}\n"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 100
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}
}