IInbox.sol 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. // Copyright 2021-2022, Offchain Labs, Inc.
  2. // For license information, see https://github.com/nitro/blob/master/LICENSE
  3. // SPDX-License-Identifier: BUSL-1.1
  4. // OpenZeppelin Contracts (last updated v4.8.0) (vendor/arbitrum/IInbox.sol)
  5. // solhint-disable-next-line compiler-version
  6. pragma solidity >=0.6.9 <0.9.0;
  7. import "./IBridge.sol";
  8. import "./IDelayedMessageProvider.sol";
  9. interface IInbox is IDelayedMessageProvider {
  10. function bridge() external view returns (IBridge);
  11. // OpenZeppelin: changed return type from ISequencerInbox
  12. function sequencerInbox() external view returns (address);
  13. /**
  14. * @notice Send a generic L2 message to the chain
  15. * @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
  16. * @param messageData Data of the message being sent
  17. */
  18. function sendL2MessageFromOrigin(bytes calldata messageData) external returns (uint256);
  19. /**
  20. * @notice Send a generic L2 message to the chain
  21. * @dev This method can be used to send any type of message that doesn't require L1 validation
  22. * @param messageData Data of the message being sent
  23. */
  24. function sendL2Message(bytes calldata messageData) external returns (uint256);
  25. function sendL1FundedUnsignedTransaction(
  26. uint256 gasLimit,
  27. uint256 maxFeePerGas,
  28. uint256 nonce,
  29. address to,
  30. bytes calldata data
  31. ) external payable returns (uint256);
  32. function sendL1FundedContractTransaction(
  33. uint256 gasLimit,
  34. uint256 maxFeePerGas,
  35. address to,
  36. bytes calldata data
  37. ) external payable returns (uint256);
  38. function sendUnsignedTransaction(
  39. uint256 gasLimit,
  40. uint256 maxFeePerGas,
  41. uint256 nonce,
  42. address to,
  43. uint256 value,
  44. bytes calldata data
  45. ) external returns (uint256);
  46. function sendContractTransaction(
  47. uint256 gasLimit,
  48. uint256 maxFeePerGas,
  49. address to,
  50. uint256 value,
  51. bytes calldata data
  52. ) external returns (uint256);
  53. /**
  54. * @notice Get the L1 fee for submitting a retryable
  55. * @dev This fee can be paid by funds already in the L2 aliased address or by the current message value
  56. * @dev This formula may change in the future, to future proof your code query this method instead of inlining!!
  57. * @param dataLength The length of the retryable's calldata, in bytes
  58. * @param baseFee The block basefee when the retryable is included in the chain, if 0 current block.basefee will be used
  59. */
  60. function calculateRetryableSubmissionFee(uint256 dataLength, uint256 baseFee) external view returns (uint256);
  61. /**
  62. * @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
  63. * @dev This does not trigger the fallback function when receiving in the L2 side.
  64. * Look into retryable tickets if you are interested in this functionality.
  65. * @dev This function should not be called inside contract constructors
  66. */
  67. function depositEth() external payable returns (uint256);
  68. /**
  69. * @notice Put a message in the L2 inbox that can be reexecuted for some fixed amount of time if it reverts
  70. * @dev all msg.value will deposited to callValueRefundAddress on L2
  71. * @dev Gas limit and maxFeePerGas should not be set to 1 as that is used to trigger the RetryableData error
  72. * @param to destination L2 contract address
  73. * @param l2CallValue call value for retryable L2 message
  74. * @param maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee
  75. * @param excessFeeRefundAddress gasLimit x maxFeePerGas - execution cost gets credited here on L2 balance
  76. * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled
  77. * @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)
  78. * @param maxFeePerGas price bid for L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
  79. * @param data ABI encoded data of L2 message
  80. * @return unique message number of the retryable transaction
  81. */
  82. function createRetryableTicket(
  83. address to,
  84. uint256 l2CallValue,
  85. uint256 maxSubmissionCost,
  86. address excessFeeRefundAddress,
  87. address callValueRefundAddress,
  88. uint256 gasLimit,
  89. uint256 maxFeePerGas,
  90. bytes calldata data
  91. ) external payable returns (uint256);
  92. /**
  93. * @notice Put a message in the L2 inbox that can be reexecuted for some fixed amount of time if it reverts
  94. * @dev Same as createRetryableTicket, but does not guarantee that submission will succeed by requiring the needed funds
  95. * come from the deposit alone, rather than falling back on the user's L2 balance
  96. * @dev Advanced usage only (does not rewrite aliases for excessFeeRefundAddress and callValueRefundAddress).
  97. * createRetryableTicket method is the recommended standard.
  98. * @dev Gas limit and maxFeePerGas should not be set to 1 as that is used to trigger the RetryableData error
  99. * @param to destination L2 contract address
  100. * @param l2CallValue call value for retryable L2 message
  101. * @param maxSubmissionCost Max gas deducted from user's L2 balance to cover base submission fee
  102. * @param excessFeeRefundAddress gasLimit x maxFeePerGas - execution cost gets credited here on L2 balance
  103. * @param callValueRefundAddress l2Callvalue gets credited here on L2 if retryable txn times out or gets cancelled
  104. * @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)
  105. * @param maxFeePerGas price bid for L2 execution. Should not be set to 1 (magic value used to trigger the RetryableData error)
  106. * @param data ABI encoded data of L2 message
  107. * @return unique message number of the retryable transaction
  108. */
  109. function unsafeCreateRetryableTicket(
  110. address to,
  111. uint256 l2CallValue,
  112. uint256 maxSubmissionCost,
  113. address excessFeeRefundAddress,
  114. address callValueRefundAddress,
  115. uint256 gasLimit,
  116. uint256 maxFeePerGas,
  117. bytes calldata data
  118. ) external payable returns (uint256);
  119. // ---------- onlyRollupOrOwner functions ----------
  120. /// @notice pauses all inbox functionality
  121. function pause() external;
  122. /// @notice unpauses all inbox functionality
  123. function unpause() external;
  124. // ---------- initializer ----------
  125. /**
  126. * @dev function to be called one time during the inbox upgrade process
  127. * this is used to fix the storage slots
  128. */
  129. function postUpgradeInit(IBridge _bridge) external;
  130. // OpenZeppelin: changed _sequencerInbox type from ISequencerInbox
  131. function initialize(IBridge _bridge, address _sequencerInbox) external;
  132. }