IBridge.sol 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // SPDX-License-Identifier: Apache-2.0
  2. /*
  3. * Copyright 2021, Offchain Labs, Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. pragma solidity ^0.8.0;
  18. interface IBridge {
  19. event MessageDelivered(
  20. uint256 indexed messageIndex,
  21. bytes32 indexed beforeInboxAcc,
  22. address inbox,
  23. uint8 kind,
  24. address sender,
  25. bytes32 messageDataHash
  26. );
  27. event BridgeCallTriggered(address indexed outbox, address indexed destAddr, uint256 amount, bytes data);
  28. event InboxToggle(address indexed inbox, bool enabled);
  29. event OutboxToggle(address indexed outbox, bool enabled);
  30. function deliverMessageToInbox(
  31. uint8 kind,
  32. address sender,
  33. bytes32 messageDataHash
  34. ) external payable returns (uint256);
  35. function executeCall(
  36. address destAddr,
  37. uint256 amount,
  38. bytes calldata data
  39. ) external returns (bool success, bytes memory returnData);
  40. // These are only callable by the admin
  41. function setInbox(address inbox, bool enabled) external;
  42. function setOutbox(address inbox, bool enabled) external;
  43. // View functions
  44. function activeOutbox() external view returns (address);
  45. function allowedInboxes(address inbox) external view returns (bool);
  46. function allowedOutboxes(address outbox) external view returns (bool);
  47. function inboxAccs(uint256 index) external view returns (bytes32);
  48. function messageCount() external view returns (uint256);
  49. }