IBridge.sol 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. // solhint-disable-next-line compiler-version
  5. pragma solidity >=0.6.9 <0.9.0;
  6. interface IBridge {
  7. event MessageDelivered(
  8. uint256 indexed messageIndex,
  9. bytes32 indexed beforeInboxAcc,
  10. address inbox,
  11. uint8 kind,
  12. address sender,
  13. bytes32 messageDataHash,
  14. uint256 baseFeeL1,
  15. uint64 timestamp
  16. );
  17. event BridgeCallTriggered(address indexed outbox, address indexed to, uint256 value, bytes data);
  18. event InboxToggle(address indexed inbox, bool enabled);
  19. event OutboxToggle(address indexed outbox, bool enabled);
  20. event SequencerInboxUpdated(address newSequencerInbox);
  21. function allowedDelayedInboxList(uint256) external returns (address);
  22. function allowedOutboxList(uint256) external returns (address);
  23. /// @dev Accumulator for delayed inbox messages; tail represents hash of the current state; each element represents the inclusion of a new message.
  24. function delayedInboxAccs(uint256) external view returns (bytes32);
  25. /// @dev Accumulator for sequencer inbox messages; tail represents hash of the current state; each element represents the inclusion of a new message.
  26. function sequencerInboxAccs(uint256) external view returns (bytes32);
  27. // OpenZeppelin: changed return type from IOwnable
  28. function rollup() external view returns (address);
  29. function sequencerInbox() external view returns (address);
  30. function activeOutbox() external view returns (address);
  31. function allowedDelayedInboxes(address inbox) external view returns (bool);
  32. function allowedOutboxes(address outbox) external view returns (bool);
  33. function sequencerReportedSubMessageCount() external view returns (uint256);
  34. /**
  35. * @dev Enqueue a message in the delayed inbox accumulator.
  36. * These messages are later sequenced in the SequencerInbox, either
  37. * by the sequencer as part of a normal batch, or by force inclusion.
  38. */
  39. function enqueueDelayedMessage(
  40. uint8 kind,
  41. address sender,
  42. bytes32 messageDataHash
  43. ) external payable returns (uint256);
  44. function executeCall(
  45. address to,
  46. uint256 value,
  47. bytes calldata data
  48. ) external returns (bool success, bytes memory returnData);
  49. function delayedMessageCount() external view returns (uint256);
  50. function sequencerMessageCount() external view returns (uint256);
  51. // ---------- onlySequencerInbox functions ----------
  52. function enqueueSequencerMessage(
  53. bytes32 dataHash,
  54. uint256 afterDelayedMessagesRead,
  55. uint256 prevMessageCount,
  56. uint256 newMessageCount
  57. )
  58. external
  59. returns (
  60. uint256 seqMessageIndex,
  61. bytes32 beforeAcc,
  62. bytes32 delayedAcc,
  63. bytes32 acc
  64. );
  65. /**
  66. * @dev Allows the sequencer inbox to submit a delayed message of the batchPostingReport type
  67. * This is done through a separate function entrypoint instead of allowing the sequencer inbox
  68. * to call `enqueueDelayedMessage` to avoid the gas overhead of an extra SLOAD in either
  69. * every delayed inbox or every sequencer inbox call.
  70. */
  71. function submitBatchSpendingReport(address batchPoster, bytes32 dataHash) external returns (uint256 msgNum);
  72. // ---------- onlyRollupOrOwner functions ----------
  73. function setSequencerInbox(address _sequencerInbox) external;
  74. function setDelayedInbox(address inbox, bool enabled) external;
  75. function setOutbox(address inbox, bool enabled) external;
  76. // ---------- initializer ----------
  77. // OpenZeppelin: changed rollup_ type from IOwnable
  78. function initialize(address rollup_) external;
  79. }